公司要开始限制所有VM直接上外网,于是就需要在本地搭建一套本地源,之前分享了一篇Centos的本地源搭建,同样今天也把Ubuntu的整理出来。
一、安装apt-mirror工具
# apt-get install apt-mirror
二、配置apt-mirror
由于源的内容比较多,所以最好可以单独划出一块盘存放,我放在/cache1/apt-soutce中
# vim /etc/apt/mirror.list
############# config ##################
#
set base_path /cache1/apt-source
#
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
set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
set nthreads 40
set _tilde 0
#
############# end config ##############
##########################################trusty############################
deb-amd64 http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
##########################################precise###########################
deb-amd64 http://mirrors.sohu.com/ubuntu/ precise main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ precise-security main restricted universe multiverse
deb-amd64 http://mirrors.sohu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ precise main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ precise-security main restricted universe multiverse
deb-i386 http://mirrors.sohu.com/ubuntu/ precise-updates main restricted universe multiverse
三、配置定时同步
# vim /etc/cron.d/apt-mirror
0 0 * * 0 apt-mirror /usr/bin/apt-mirror > /cache1/apt-source/var/cron.log
四、开始同步
同步过程会有提示,也可以中断,下次只要再次运行apt-mirror还会继续
# apt-mirror
五、搭建web服务
我使用的是nginx,根据自己喜好选择。
把源链接到/var/www下面
cd /var/www
ln -s /cache1/apt-source/mirror/mirrors.sohu.com/ubuntu ubuntu
六、更新本地源
源设置的是"deb http://",默认是同步64位的包,如果需要32位的支持需改成"deb-i386 http://"
# vim /etc/apt/sources.list
deb http://xx.xx.xx.xx/ubuntu precise main multiverse restricted universe
deb http://xx.xx.xx.xx/ubuntu precise-backports main multiverse restricted universe
deb http://xx.xx.xx.xx/ubuntu precise-proposed main multiverse restricted universe
deb http://xx.xx.xx.xx/ubuntu precise-updates main multiverse restricted universe
deb http://xx.xx.xx.xx/ubuntu precise-security main multiverse restricted universe
deb http://xx.xx.xx.xx/ubuntu precise-security main multiverse restricted universe
设置完成后,更新apt数据库信息
apt-get update
创造与魔法 安卓版v1.0.0750
创造与魔法是一款开放世界手游,在游戏中玩家可探索这个奇妙的世
创造与魔法修改版 最新版v1.0.0750
创造与魔法无限点券版是款探索冒险游戏,该款游戏的操作还是蛮自
战争与文明官方版本 安卓版v1.7.16
战争与文明是一款由上海邮通科技有限公司开发的战争策略游戏,这
迷你世界0元领皮肤无限迷你币版 最新安卓版v1.43.0
迷你世界0元购买皮肤版是这款开放沙盒冒险建造游戏的特殊破解版
创造与魔法无限经验版 安卓版v1.0.0750
创造与魔法无限经验版是款可以改造环境,整个游戏的自由度还是蛮