[debian]use ISO as debian apt source / 使用ISO文件作为apt源

  准备文件:

debian-9.8.0-amd64-DVD-1.iso

debian-9.8.0-amd64-DVD-2.iso

debian-9.8.0-amd64-DVD-3.iso

  挂载:

 

root@debian:~# mount -t iso9660 -o loop /debian/debian-9.8.0-amd64-DVD-1.iso /mnt/debian1
mount: /dev/loop0 is write-protected, mounting read-only
root@debian:~# mount -t iso9660 -o loop /debian/debian-9.8.0-amd64-DVD-2.iso /mnt/debian2
mount: /dev/loop1 is write-protected, mounting read-only
root@debian:~# mount -t iso9660 -o loop /debian/debian-9.8.0-amd64-DVD-3.iso /mnt/debian3
mount: /dev/loop2 is write-protected, mounting read-only

  查看mount:

/dev/sda1 on /home type ext4 (rw,relatime,data=ordered)
tmpfs on /run/user/108 type tmpfs (rw,nosuid,nodev,relatime,size=405056k,mode=700,uid=108,gid=113)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=405056k,mode=700)
/debian/debian-9.8.0-amd64-DVD-2.iso on /mnt/debian2 type iso9660 (ro,relatime)
/debian/debian-9.8.0-amd64-DVD-3.iso on /mnt/debian3 type iso9660 (ro,relatime)
/debian/debian-9.8.0-amd64-DVD-1.iso on /mnt/debian1 type iso9660 (ro,relatime)

  修改/etc/fstab:

[defaults 可以改为 user,loop]

   添加apt源:

#vim /etc/apt/sources.list

删除这个文件

 

apt-cdrom -m -d=/mnt/debian1 add

apt-cdrom -m -d=/mnt/debian2 add

apt-cdrom -m -d=/mnt/debian3 add

 

  新增apt.conf

Acquire::cdrom::mount "/mnt/debian1";
Acquire::cdrom::mount "/mnt/debian2";
Acquire::cdrom::mount "/mnt/debian3";
APT::CDROM::NoMount;

 

 

目前只能安装第一张DVD中的包 如果在后两个磁盘(如lsscsi)会提示需要插入磁盘:

root@debian:~# apt install lsscsi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  lsscsi
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/35.6 kB of archives.
After this operation, 89.1 kB of additional disk space will be used.
Media change: please insert the disc labeled
 'Debian GNU/Linux 9.8.0 _Stretch_ - Official amd64 DVD Binary-2 20190216-11:59'
in the drive '/mnt/debian1/' and press [Enter]

 

posted @ 2019-04-22 16:49  夜歌乘年少  阅读(814)  评论(1编辑  收藏  举报