下面是使用apt-mirror搭建Ubuntu软件源的实例教程,具体步骤如下:
sudo apt-get install apt-mirror
进行安装。sudo vim /etc/apt/mirror.list
;deb https://cn.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb https://cn.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://cn.archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://cn.archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
这里默认使用的是Ubuntu 18.04 LTS版本的软件源。
3. 使用以下命令启动apt-mirror:sudo apt-mirror
;
4. 等待下载完成即可。下载过程中,可以使用tail -f /var/spool/apt-mirror/var/cn.archive.ubuntu.com/ubuntu/archive-mirror.log
查看下载进度。
sudo vim /etc/apt/sources.list
;deb file:/mirror/cn.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb file:/mirror/cn.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb file:/mirror/cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb file:/mirror/cn.archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
这里的/mirror
指的是本地搭建的软件源目录。如果没有指定目录,则默认在/var/spool/apt-mirror/mirror/cn.archive.ubuntu.com/ubuntu
下。
3. 更新软件源,执行命令sudo apt-get update
。
示例一:安装Ubuntu桌面环境
sudo apt-get install ubuntu-desktop
,开始下载Ubuntu桌面环境的安装包;sudo systemctl set-default graphical.target
,切换到Ubuntu桌面环境。示例二:安装apache
sudo apt-get install apache2
,开始下载安装apache2的安装包;systemctl status apache2
命令来检查apache是否正常运行。综上所述,使用apt-mirror搭建Ubuntu软件源非常简单,只需要几个简单的步骤即可完成,而且对于软件包的下载速度有较大的提升。
本文链接:http://task.lmcjl.com/news/3439.html