网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

Ubuntu16.04建立本地更新源

时间:2024-10-21 20:00:28

1、安装apt-mirror工具sudo apt-get install -y apt-mirror

2、配置apt-mirror工具sudo gedit /etc/apt/mirror.list修改更新源地址为阿里云镜像地址,下载速度更快。如果只下载64位的更新,在执行apt-get update时会报错,因此把32位的一起加进来,这样就不会报错了。下面注释掉的5行是源码,一般不需要,如果有需要,去掉注释就可以一起下载了。

Ubuntu16.04建立本地更新源

3、开始制作,64位的更新大约有114G,32位的大约有58G。sudo apt-mirror

Ubuntu16.04建立本地更新源

4、添加定时任务每日自动更新镜像sudo crontab -eChoose 1-3 [2]:2在文件最下面加入如下配置:每天1:30自动更新,并且把更新日志记录在cron.log30 1 * * * /usr/bin/apt-mirror >> /var/spool/apt-mirror/var/cron.log

Ubuntu16.04建立本地更新源

5、作为本机源下载到本机的更新粝简肯惧内容在 /var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu,执行如下命令修改sources.listsudo gedit /etc/apt/sources.list把原有内容替换为以下内容:deb file:///var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu xenial main restricted universe multiversedeb file:///var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu xenial-security main restricted universe multiversedeb file:///var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu xenial-updates main restricted universe multiversedeb file:///var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu xenial-proposed main restricted universe multiversedeb file:///var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu xenial-backports main restricted universe multiverse

6、安装apache2(如果没有的话)sudo apt-get install -y apache2将镜像目录链接到apache2的根目录(/var/www/html/)下sudo ln -s /var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu /var/www/html/ubuntu

7、修改局域网内其他ubuntu主机的sources.list文件执行如下命令修改sources.listsudo gedit /etc/apt/sour艘早祓胂ces.list把原有内容替换为以下内容,其中xxx.xxx.xxx.xxx为本地更新源服务器的IP地址deb http://xxx.xxx.xxx.xxx/ubuntu xenial main restricted universe multiversedeb http://xxx.xxx.xxx.xxx/ubuntu xenial-security main restricted universe multiversedeb http://xxx.xxx.xxx.xxx/ubuntu xenial-updates main restricted universe multiversedeb http://xxx.xxx.xxx.xxx/ubuntu xenial-proposed main restricted universe multiversedeb http://xxx.xxx.xxx.xxx/ubuntu xenial-backports main restricted universe multiverse

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com