码迷,mamicode.com
首页 > 系统相关 > 详细

制作本地ubuntu镜像站 (local package source mirror site)

时间:2015-08-19 20:13:32      阅读:388      评论:0      收藏:0      [点我收藏+]

标签:

实验室机房搭建High Availability Openstack 环境,为了保证内网的安全,我们采用了jumpbox的方式来访问内部server。这样内部

结点无法访问外网,安装package不太方便,于是在jumpbox上面制作一个ubuntu的全镜像站。

sudo apt-get install apache2
sudo apt-get install apt-mirror

 apt-mirror 是镜像工具,apache2是为了给局域网服务器提供http服务

1.配置/etc/apt/mirror.list

新建一个目录用来存放package,在下载前预留足够的控件,trusty所有的包和src一共需要大概140G

# mkdir /mnt/trusty-repositor
# vim /etc/apt/mirror.list

############# config ##################
#
set base_path /mnt/trusty-repository                                                       #设置根目录
#
# 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 postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
###########ubuntu 14.04 software source
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse                      
deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
##########################################
#deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
##########################################
#deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
####################ubuntu src source
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse       #磁盘空间不足,不需要源码,可以不下载,几乎减少一半
deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
######################################
#deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
#clean http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/juno main
#clean http://archive.ubuntu.com/ubuntu
clean http://archive.ubuntu.com/ubuntu

2.配置apache2

习惯上apache2的默认主目录是/var/www

#vim /etc/apache2/sites-available/000-default.conf

DocumentRoot /var/www   可以自定义为自己想要的目录

#ln -s /mnt/trusty-repository /var/www/ubuntu
#ln -s /mnt/trusty-repository/mirror/archive.ubuntu.com /var/www/ubuntu

3.在局域网客户端处配置source.list

#vim /etc/apt/source.list

删除其他,添加一行

deb http://10.74.15.13/ubuntu/ubuntu trusty main restricted universe multiverse

#vim apt-get update

制作本地ubuntu镜像站 (local package source mirror site)

标签:

原文地址:http://www.cnblogs.com/SnowStark/p/4742729.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!