Linux系统各发行版换国内yum或apt源,加速软件下载更新

Centos、Ubuntu、Debian、Fedora、OpenSUSE、FreeBSD系统换软件源

Linux系统安装完后软件源一般都是国外服务器,在国内特别慢,这时候就需要更换国内的镜像源。

高性价比和便宜的VPS/云服务器推荐:https://blog.zeruns.tech/archives/383.html

Centos

1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、更换源

下载新的CentOS-Base.repo/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

注意http://mirrors.aliyun.com/repo/Centos-7.repo中的7改为自己的Centos版本号,比如Centos 8就是http://mirrors.aliyun.com/repo/Centos-8.repo

3、运行yum makecache生成缓存

yum makecache

Ubuntu

1.备份

sudo cp /etc/apt/sources.list /etc/apt/sources_init.list

将以前的源备份一下,以防以后可以用的。

2.更改文件权限使其可编辑

sudo  chmod  777  /etc/apt/source.list

3.更换源

sudo nano /etc/apt/sources.list

使用nano打开文本,删除原来文件里的内容,将下面其中一个源复制进去,然后保存。

阿里源:


                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zeruns

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值