首页 > 代码库 > 创建本地Ubuntu镜像
创建本地Ubuntu镜像
- 参考文档 http://www.howtoforge.com/local_debian_ubuntu_mirror
- 安装服务 :
sudo
apt-get
install
apt-mirror apache2
- 配置apt-mirror(/etc/apt/mirror.list)
############# config ###################set base_path /mnt/raid5/apt-mirror############# config ###################修改默认路径set base_path /mnt/raid5/apt-mirror set mirror_path $base_path/mirrorset skel_path $base_path/skelset var_path $base_path/varset cleanscript $var_path/clean.shset defaultarch amd64 #<running host architecture>set postmirror_script $var_path/postmirror.shset run_postmirror 0set nthreads 20set _tilde 0############## end config ###############Ubuntu 12.04 LTSdeb http://mirrors.163.com/ubuntu precise main restricted universe multiversedeb http://mirrors.163.com/ubuntu precise-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu precise-updates main restricted universe multiverse#deb http://mirrors.163.com/ubuntu precise-proposed main restricted universe multiverse#deb http://mirrors.163.com/ubuntu precise-backports main restricted universe multiverse#Ubuntu 14.04 LTSdeb http://mirrors.163.com/ubuntu trusty main restricted universe multiversedeb http://mirrors.163.com/ubuntu trusty-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu trusty-updates main restricted universe multiverse#没有同步源代码#deb-src http://mirrors.163.com/ubuntu precise main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu precise-security main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu precise-updates main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu precise-proposed main restricted universe multiverse#deb-src http://mirrors.163.com/ubuntu precise-backports main restricted universe multiverse clean http://mirrors.163.com/ubuntu
- 创建本地仓库: su - apt-mirror -c apt-mirror #切换为root用户,否则需要为apt-mirror创建密码(206为mirror)
- 清理本地仓库: sudo /bin/bash /mnt/raid5/apt-mirror/var/clean.sh
- 配置自动同步本地源: sudo vim /etc/cron.d/apt-mirror #打开注释掉的最后一行
- 让本地仓库可通过HTTP访问: sudo ln -sf /mnt/raid5/apt-mirror/mirror/mirrors.163.com/ubuntu/ /var/www/ubuntu
配置客户端源(在个人电脑上)
cd /etc/apt
sudo rm sources.list.d/* apt.conf.d/* -rf
sudo cp sources.list{,.bak}
#用下面三行替换掉sources.list里的全部内容
deb [arch=amd64] http://10.0.0.206/ubuntu/ precise main restricted universe multiverse
deb [arch=amd64] http://10.0.0.206/ubuntu/ precise-updates main restricted universe multiverse
deb [arch=amd64] http://10.0.0.206/ubuntu/ precise-security main restricted universe multiverse- 试试本地源
sudo apt-get update
创建本地Ubuntu镜像
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。