- 参考文档 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/mirror
set skel_path $base_path/skel
set var_path $base_path/var
set cleanscript $var_path/clean.sh
set defaultarch amd64 #<running host architecture>
set postmirror_script $var_path/postmirror.sh
set run_postmirror
set nthreads
set _tilde
#
############# end config ##############
#Ubuntu 12.04 LTS
deb http://mirrors.163.com/ubuntu precise main restricted universe multiverse
deb http://mirrors.163.com/ubuntu precise-security main restricted universe multiverse
deb 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 LTS
deb http://mirrors.163.com/ubuntu trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu trusty-security main restricted universe multiverse
deb 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
相关文章
- 03-23ubuntu 使用appimage安装的应用,应该怎么创建桌面的快捷方式
- 03-23使用docker、编写dockerfile、httpd镜像,并启动镜像,创建httpd主页和分页。(2)
- 03-23Ubuntu Kylin创建桌面快捷方式【以Pycharm为例】
- 03-23Ubuntu 自己写的程序如何创建快捷方式-在application里创建快捷方式
- 03-23【树莓派Linux内核开发】入门实操篇(虚拟机Ubuntu环境搭建+内核源码获取与配置+内核交叉编译+内核镜像挂载)
- 03-23如何在本地创建一个贪吃蛇小游戏node.js服务并实现无公网IP远程游玩
- 03-23ubuntu20.04 创建ros环境、创建rospackage
- 03-23microk8s使用本地库的镜像部署服务
- 03-23linux系统中docker镜像创建、导入导出和执行
- 03-23使用Java拓展本地开源大模型的网络搜索问答能力-创建SerpApi对象