Linux更换软件源
一、更换Ubuntu软件源
这里以Ubuntu20.04.1示例
以阿里云为例
- 查看Ubuntu代号
lsb_release -a | grep Codename
# Codename: focal
所以我当前的版本代号为:focal
- 备份源
cp /etc/apt/sources.list /etc/apt/sources.list.backup
- 更换源
vim /etc/apt/sources.list
将默认的删除,更换为ubuntu 20.04(focal)
的配置:
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
- 检查
sudo apt update
- 更新
sudo apt upgrade
如果是其他的版本,可以将这里的focal
换为自己的即可
二、更换CentOS软件源
这里是从阿里云那里拿过来的。
配置方法
- 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
- CentOS6
或者wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
- CentOS7
或者wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
- CentOS8
或者wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
- CentOS6
-
生成缓存
yum makecache
- 其他
非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg:
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
三、更换Kali软件源
readying...
附录:常用开源镜像站
序号 | 名称 | 镜像站点 |
---|---|---|
1 | 阿里源 | https://mirrors.aliyun.com/ |
2 | 腾讯源 | https://mirrors.cloud.tencent.com/ |
3 | 花为源 | https://mirrors.huaweicloud.com/ |
4 | 清华源 | https://mirrors.tuna.tsinghua.edu.cn/ |
5 | 豆瓣源 | http://www.debian.org/mirror/list |
6 | 网易源 | http://mirrors.163.com/ |
7 | 中科源 | http://mirrors.opencas.cn/ |
8 | 搜狐源 | http://mirrors.sohu.com/ |
9 | 公云源 | http://mirrors.pubyun.com/ |
10 | 首都在线 | http://mirrors.yun-idc.com/ |
11 | Linux运维 | http://mirrors.skyshe.cn/ |
12 | 北京理工大学源 | http://mirror.bit.edu.cn/web/ |
13 | 北京交通大学源 | http://mirror.bjtu.edu.cn/cn/ |
14 | 兰州大学源 | http://mirror.lzu.edu.cn/ |
15 | 中国科技大学源 | http://mirrors.ustc.edu.cn/ |
16 | 浙江大学源 | http://mirrors.zju.edu.cn/ |
17 | 厦门大学源 | http://mirrors.xmu.edu.cn/ |
18 | 东北大学源 | http://mirror.neu.edu.cn/ |
19 | 华中科技大学源 | http://mirrors.hust.edu.cn/ |
20 | 重庆大学源 | http://mirrors.cqu.edu.cn/ |
21 | 东软信息学院源 | http://mirrors.neusoft.edu.cn/ |
22 | 大连理工大学源 | http://mirror.dlut.edu.cn/ |
23 | 上海交通大学源 | http://ftp.sjtu.edu.cn/ |
24 | 更多开源镜像站 | https://www.douban.com/note/375227086/ |