赞
踩
配置apt国内镜像源可以加快软件包的下载速度,提高软件安装的效率。如果使用默认的官方源,由于网络原因,下载速度可能会很慢,甚至无法下载。而使用国内的镜像源,可以避免这些问题,提高软件下载的速度和成功率。
首先,先备份旧的源(在修改文件前先备份文件是一个好的习惯)
liujie@liujie-virtual-machine-18:~$ sudo su
[sudo] liujie 的密码:
root@liujie-virtual-machine-18:/home/liujie# sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
root@liujie-virtual-machine-18:/home/liujie# ls -l /etc/apt/sources.list*
-rw-rw-r-- 1 root root 2886 8月 7 14:18 /etc/apt/sources.list
-rw-r--r-- 1 root root 2886 11月 9 23:48 /etc/apt/sources.list.bak
-rw-rw-r-- 1 root root 2906 8月 7 14:18 /etc/apt/sources.list.save
设置新的镜像源
root@liujie-virtual-machine-18:/home/liujie# vim /etc/apt/sources.list
将默认的源删除掉,添加国内的镜像源,例如:清华源、阿里源、中科大源等
在vim中删除文件中所有内容的指令是
:1,$d
其中,:
表示进入命令模式,1,$
表示从第一行到最后一行,d
表示删除。执行该指令后,文件中所有内容都会被删除。
清华源:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
阿里源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
中科大源:
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
没有必要全部添加,选择一个即可
更新软件包列表并升级已安装的软件包
root@liujie-virtual-machine-18:/home/liujie# apt-get update
root@liujie-virtual-machine-18:/home/liujie# apt-get upgrade
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。