Ubuntu 更换 Apt 源为阿里云

Posted by Yun on Mon, Dec 3, 2018

Ubuntu 默认的 apt 源下载速度不稳定,可以考虑切换到国内的 apt 镜像源。

Step1. 备份 list 文件

进入对应文件夹,用管理员权限,执行复制操作:

1cd /etc/apt/
2sudo cp sources.list sources.list.bak

Step2. 修改 list 文件

通过管理员权限,使用 vim 进行修改:

1sudo vim sources.list

将文件中所有 url 地址,修改为 http://mirrors.aliyun.com/ubuntu/ 即可。

Step3. 更新软件列表

使用管理员权限,执行命令:

1sudo apt-get update
2sudo apt-get upgrade

P.S.
命令 apt-get update 是更新软件列表
命令 apt-get upgrade 是更新软件


附:国内常见源

阿里云:

 1deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 2deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 3deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 4deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 5deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
 6deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 7deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 8deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 9deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
10deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

中科大:

 1deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
 2deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
 3deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 4deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 5deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 6deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 7deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 8deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 9deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
10deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

网易:

 1deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
 2deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
 3deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
 4deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
 5deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
 6deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
 7deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
 8deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
 9deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
10deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清华:

 1deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
 2deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
 3deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 4deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 5deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 6deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 7deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 8deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 9deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
10deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

参考链接

Ubuntu18.04下更改apt源为阿里云源
Ubuntu 18.04换国内源 中科大源 阿里源 163源 清华源
ubuntu sudo update与upgrade的作用及区别


版权声明:本文遵循 CC BY-SA 4.0 版权协议,转载请附上原文出处链接和本声明。

Copyright statement: This article follows the CC BY-SA 4.0 copyright agreement. For reprinting, please attach the original source link and this statement.