您的位置:首页 > 教育 > 锐评 > Ubuntu、CentOs更换源(阿里云的源)

Ubuntu、CentOs更换源(阿里云的源)

2025/5/7 9:41:45 来源:https://blog.csdn.net/qq_45742976/article/details/140128759  浏览:    关键词:Ubuntu、CentOs更换源(阿里云的源)

ubuntu

  1. 备份当前的apt配置文件
sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup
  1. 编辑配置文件,将以下内容写到文件中sudo vi /etc/apt/sources.list
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse 
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse 
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse 
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  1. 更新
# 更新源
sudo apt update
# 更新系统中已安装的软件包
sudo apt upgrade

centos

  1. 备份当前的yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载新的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
  1. 清空并生成缓存
yum clean all
yum makecache

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com