概述
公司要开始限制所有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
最后
以上就是落寞背包为你收集整理的aptget本地源 ubuntu_乌班图Ubuntu系统搭建本地源方法的全部内容,希望文章能够帮你解决aptget本地源 ubuntu_乌班图Ubuntu系统搭建本地源方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复