How to use an ISO file as offline repository in Debian

来自linux中国网wiki
跳到导航 跳到搜索

** Create the folders (mountpoint) to mount the ISO files

sudo mkdir -p /media/repo_1
sudo mkdir -p /media/repo_2
sudo mkdir -p /media/repo_3 

** Debian ISO image downloaded at the location /root

cd /root &&  wget  -c  https://mirrors.163.com/debian-cd/10.5.0/amd64/iso-dvd/debian-10.5.0-amd64-DVD-1.iso

wget  -c  https://mirrors.163.com/debian-cd/10.5.0/amd64/iso-dvd/debian-10.5.0-amd64-DVD-2.iso

wget  -c  https://mirrors.163.com/debian-cd/10.5.0/amd64/iso-dvd/debian-10.5.0-amd64-DVD-3.iso

** mount the ISO files

*** temp

sudo p mount  -o loop  /root/debian-10.5.0-amd64-DVD-1.iso  /media/repo_1/
sudo p mount  -o loop  /root/debian-10.5.0-amd64-DVD-1.iso  /media/repo_2/
sudo p mount  -o loop  /root/debian-10.5.0-amd64-DVD-1.iso  /media/repo_3/

*** forever

sudo vi /etc/fstab

/root/debian-10.5.0-amd64-DVD-1.iso  /media/repo_1/  iso9660 defaults,loop,  0 0
/root/debian-10.5.0-amd64-DVD-1.iso  /media/repo_2/  iso9660 defaults,loop,  0 0
/root/debian-10.5.0-amd64-DVD-1.iso  /media/repo_3/  iso9660 defaults,loop, 0 0

** edit the /etc/apt/sources.list file to add the repository

deb [trusted=yes]  file:///media/repo_1/  buster  main contrib
deb [trusted=yes]  file:///media/repo_2/  buster  main contrib
deb [trusted=yes]  file:///media/repo_3/  buster  main contrib 


* 快速查看每个 iso的软件

ls /media/repo_1/pool/main/
eg  ls /media/repo_1/pool/main/z/  得知有 zip    apt install zip

* see also

How to use an ISO file as offline repository in Debian

https://linuxconfig.org/add-iso-image-to-apt-sourceslist


Debian & CentOS建立本地iso源

* trouble

Reading package lists... Done
E: The repository 'file:/media/repo_1 buster Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
[email protected]:~#

You should tell apt it's a trusted source:

deb [trusted=yes] file:///media/repo_1/  buster  main contrib