yum更换源

1. 更换163源

https://mirrors.163.com/.help/centos.html

 

2. 更换中科大源

https://mirrors.ustc.edu.cn/help/centos.html

 

3. 更换清华源

https://mirrors.tuna.tsinghua.edu.cn/help/centos/

 

cd /etc/yum.repos.d

vim CentOS-Base.repo

写入:

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

yum clean all

yum makecache

yum -y install update

 

4. 更换阿里源

https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b110mHduj

 

cd /etc/yum.repos.d

 mv CentOS-Base.repo CentOS-Base.repo.bak

wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum clean all

yum makecache

yum -y install update

 

5. 更换sohu源

http://mirrors.sohu.com/centos/

 

posted @ 2023-04-04 17:56  Shiyu_Huang  阅读(614)  评论(0编辑  收藏  举报