建立本地Ubuntu软件源镜像

建立本地Ubuntu软件源镜像

1)、安装apt-mirror sudo apt-get install apt-mirror 2)、修改mirror.list 如果什么都不加,直接使用deb http.....这种格式,则在同步时,只同步当前系统所使用的架构下的软件包。比如一个64位系统,直接deb http....只同步64位的软件包。如果还嫌麻烦,直接去改set defaultarch <running host architecture>这个参数就好,比如改成set defaultarch i386,这样你使用deb http.....这种格式,则在同步时,只同步i386的软件包了。

sudo gedit /etc/apt/mirror.list 文件内容如下: ——————————————引用开始—————————————————— ############# config ##################

set base_path /var/spool/apt-mirror [镜像存放目录位置,可根据磁盘容量情况进行更改]

if you change the base path you must create the directories below with write privileges

set mirror_path $base_path/mirror

set skel_path $base_path/skel

set var_path $base_path/var

set cleanscript $var_path/clean.sh

set defaultarch <running host architecture>

set nthreads 3 [下载进程,默认20,建议3] set _tilde 0

############# end config ############## #注意这里的jaunty代码版本号, jaunty代表9.04版本,请根据需要版本自行更改 deb http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse [需要进行镜像的APT软件源地址,选择速度较快的官方源或国内源]

#deb-src http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-security main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse [不需要源代码,用#进行地址屏蔽]

clean http://archive.ubuntu.com/ubuntu [镜像完成后对本地镜像和软件源进行比较] ——————————————引用结束—————————————————— 3)、修改完成后开始镜像 sudo apt-mirror 4)、完成镜像后进行清理多余文件 sudo /var/spool/apt-mirror/var/clean.sh 5)、修改sources.list将升级地址修改为本地镜像 sudo gedit /etc/apt/sources.list 文件内容修改按如下步骤进行: A:只供本机使用,不需要提供给所在网络的其他人使用。 Sources.list文件将源地址修改为: deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/jaunty main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-backports restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.org.cn/ubuntu-cn/ jaunty main restricted universe multiverse 注意:如果报错找不到i386之类的目录,可以设置deb-src为只寻找64bit系统的源

B:除了自己使用外,还要提供网络里的其他用户进行更新。 第一步,安装Apache2 sudo apt-get install apache2 第二步,建立符号连接,将镜像与Apache虚拟目录联系起来 sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ /var/www/ubuntu sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.org.cn/ubuntu-cn /var/www/ubuntu-cn 第三步,修改sources.list文件 deb-src http://192.168.0.10/ubuntu jaunty main restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-backports restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-proposed main restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-security main restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-updates main restricted universe multiverse

大功告成!!!终于OVER了。

转载于:https://my.oschina.net/chirnson/blog/270640

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值