公司要开始限制所有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
茶杯头甜蜜终章dlc 官方手机版v1.0.0.3
下载火柴人传说暗影格斗内置菜单 最新版v3.0.1
下载荒野乱斗测试服 安卓版v61.10.3
下载荒野乱斗彩虹服 安卓版v61.10.3
下载寒霜启示录 安卓版v1.25.10
寒霜启示录是一款生存模拟游戏,不少玩家可能对于末日都有着自己
末日城堡免广告版 安卓最新版v0.7.1
末日城堡免广告版是一款非常好玩的模拟经营类游戏,内部可以不看
甜蜜人生模拟器 最新版v1.4.5
甜蜜人生模拟器是一款非常好玩的模拟恋爱手游,玩家在这里能够对
武器锻造师内置功能菜单 v10.4
武器锻造师内置菜单版是游戏的破解版本,在该版本中为玩家提供了
开放空间overfield 安卓版v1.0.5
开放空间Overfield是一款箱庭养成经营手游,让你在广阔