标签:ubuntu
概述
说了centos的epel源搭建方式后,在说下ubuntu镜像源及openstack本地源的搭建。
步骤
1.安装apt-mirror
#apt-get install apt-mirror
2.手动建立/apt/ubuntu目录,并修改/etc/apt/mirror.list,添加如下内容:
############# config ################## # # set base_path /var/spool/apt-mirror set base_path /apt/ubuntu # set mirror_path $base_path/mirror # set skel_path $base_path/skel # set var_path $base_path/var # set cleanscript $var_path/clean. # set defaultarch <running host architecture> # set postmirror_script $var_path/postmirror.sh set run_postmirror 0 set nthreads 20 set _tilde 0 deb http://mirrors.163.com/ubuntu/ trusty main restricted deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted deb http://mirrors.163.com/ubuntu/ trusty universe deb http://mirrors.163.com/ubuntu/ trusty-updates universe deb http://mirrors.163.com/ubuntu/ trusty multiverse deb http://mirrors.163.com/ubuntu/ trusty-updates multiverse deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-security main restricted deb http://mirrors.163.com/ubuntu/ trusty-security universe deb http://mirrors.163.com/ubuntu/ trusty-security multiverse deb http://extras.ubuntu.com/ubuntu trusty main clean http://mirrors.163.com/ubuntu/ deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/liberty main
3.执行apt-mirror ,开始下载和同步软件包
#apt-miiror
4.安装apache,并将本底源挂接到 apache的 WWW根目录
#apt-miiror #apt-get install apache2 #cd /var/www/html/ #ln -s /apt/ubuntu/mirror/mirrors.163.com/ubuntu #ln -s /apt/ubuntu/mirror/ubuntu-cloud.archive.canonical.com/ubuntu openstack
确保能通过http://x.x.x.x/ubuntu 或 http://x.x.x.x/openstack能访问目录内容
5.通过计划任务定期同步源
#Crontab -e 0 22 * * * /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log
6.配置客户端源,编辑/etc/apt/source.list,删除其他内容,加入:
deb http://10.0.0.100/ubuntu/ trusty main restricted deb http://10.0.0.100/ubuntu/ trusty-updates main restricted deb http://10.0.0.100/ubuntu/ trusty universe deb http://10.0.0.100/ubuntu/ trusty-updates universe deb http://10.0.0.100/ubuntu/ trusty multiverse deb http://10.0.0.100/ubuntu/ trusty-updates multiverse deb http://10.0.0.100/ubuntu/ trusty-backports main restricted universe multiverse deb http://10.0.0.100/ubuntu/ trusty-security main restricted deb http://10.0.0.100/ubuntu/ trusty-security universe deb http://10.0.0.100/ubuntu/ trusty-security multiverse deb http://10.0.0.100/openstack/ trusty-updates/liberty main
客户端更新:
#apt-get update
标签:ubuntu
原文地址:http://h11345.blog.51cto.com/780987/1727872