debian及ubuntu挂载本地硬盘的ISO镜像文件
1.定位Debian ISO镜像的位置,比如说sda3
fdisk -l
2.挂载:
# mount -t auto /dev/sda3 /media/mnt
生成isodebian路径 /mnt# mkdir isodebian
t# mount -o loop /media/mnt/debian-8.4.0-amd64-DVD-1.iso /mnt/isodebian
mount: /dev/loop0 is write-protected, mounting read-only
3.添加本地源
/etc/apt# vi sources.list
deb http://ftp.cn.debian.org/debian/ jessie main contrib
deb-src http://ftp.cn.debian.org/debian/ jessie main contrib
deb file:///mnt/isodebian jessie main contrib
4. 验证更新
#apt-get update
最好写成一下脚本:
isomount.sh
#!bash/sh
mount -t auto /dev/sda3 /media/mnt
mount -o loop /media/mnt/debian-8.4.0-amd64-DVD-1.iso /mnt/isodebian
apt-get update
对于debian衍生出来的ubuntu系统,挂在本地磁盘的iso系统镜像:
先备份源:
$ cd /etc/apt
$ cp -p sources.list sources.list_BK
在sources.list 中添加下面两行.
deb file:///media/ubuntu-14.04.1/ubuntu trusty main
deb file:///media/ubuntu-14.04.1/ubuntu trusty restricted
说明:deb file:// #debian系列ISO源的固定格式 media/ubuntu-14.04.1