Ubuntu--更改国内镜像源
1.备份
sudo cp /etc/apt/sources.list /etc/apt/sources.bak1
#第一个参数时拷贝的文件路径和文件名称,第二个是拷贝到(粘贴)的文件路径和文件名
2.更改权限
sudo chmod 777 /etc/apt/sources.list
3.更改镜像内容
清空原来的内容
> /etc/apt/sources.list
sudo vi /etc/apt/sources.list
1 #阿里源 2 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 3 deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 4 deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 5 deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 6 deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 7 deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 8 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 9 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 10 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 11 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 12 #网易源 13 deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse 14 deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse 15 deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse 16 deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse 17 deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse 18 deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse 19 deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse 20 deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse 21 deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse 22 deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse 23 #清华源 24 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse 25 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse 26 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse 27 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse 28 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse 29 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse 30 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse 31 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse 32 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse 33 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse 34 #中科大源 35 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse 36 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse 37 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse 38 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse 39 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse 40 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse 41 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse 42 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse 43 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse 44 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
4.更新源列表
sudo apt-get update
#这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。
我们在新立得软件包管理器里看到的软件列表,都是通过update命令更新的。
5.更新软件
sudo apt-get upgrade
#这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,
就会提示你更新。如果你的软件都是最新版本,会提示:
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。