CentOS 8 EOL如何切换源?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 8 EOL如何切换源?相关的知识,希望对你有一定的参考价值。
参考技术A 一、[endif] 为啥centos8要换源?当前时间是2022年2月22号
2021年12月31日CentOS 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。后续新的服务器建议使用CentOS Stream,或者其他linux版本,按照社区规则,CentOS 8的源地址http://mirror.centos.org/centos/8/内容已移除,目前第三方的镜像站中均已移除CentOS 8的源。但是对于业务过渡期仍然需要使用centos8,并且在上面安装软件,那我们需要更新备用源,之前第三方的源都是同步centos官方的,并随之更新,官方的源去掉后,第三方也就无法同步到了,所以第三方的源也就不复存在了,但是大部分第三方都把最后的源做了个备份弄了个新的地址,方便过渡期使用。当然切换到阿里云的源速度也会更快些。
阿里云镜像站官网: https://developer.aliyun.com/mirror/
阿里云centos源地址: https://developer.aliyun.com/mirror/centos
二、[endif] 如何更换centos8源的阿里云镜像地址
两种情况,阿里云ecs和非阿里云ecs,非阿里云ecs要求可以连接上公网,如果是阿里云ecs使用阿里云提供的内网链接源,不是阿里云的服务器,使用的公网源,肯定内网源的速度会更快些。
仔细观察就能发现内网链接:mirrors.cloud.aliyuncs.com
公网链接:mirrors.aliyun.com
非阿里云服务器用户:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https: //mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache
阿里云服务器用户:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https: //mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all && yum makecache
三、[endif] 其他工具换源
推荐使用linux一键换源脚本, https://supermanito.github.io/LinuxMirrors/#/
不仅支持centos,还支持其他linux发行版本,感谢原作者的无私奉献。
Gitee地址: https://gitee.com/SuperManito/LinuxMirrors
Redhat6.7 切换Centos yum源
转自:http://inlhx.iteye.com/blog/2336729
RedHat 更换Yum源
1.检查yum包 rpm -qa |grep yum
2.删除自带包
rpm -aq | grep yum | xargs rpm -e --nodeps
3.再检查一下
rpm -qa |grep yum
4.下载更新包
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm
5.执行安装
rpm -ivh yum-*
如果出现
error: Failed dependencies:
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
不要慌,这个问题很恶心会导致后面安装前功尽弃,使用下面
rpm -Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm
更新rpm -Uvh python-urlgrabber版本,不更新肯定安装不过去
在执行:
rpm -ivh yum-*
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 20%]
2:yum-plugin-fastestmirro########################################### [ 40%]
3:yum ########################################### [ 60%]
4:yum-updateonboot ########################################### [ 80%]
5:yum-utils ########################################### [100%]
安装成功了
6.切换源
cd /etc/yum.repos.d/
mv redhat.repo redhat.repo.bak
mv rhel-source.repo rhel-source.repo.bak
vi /etc/yum.repos.d/CentOS-Base.repo
粘贴如下信息:
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
8.清理缓存
yum clean all
yum makecache
9.验证
yum install telnet
以上是关于CentOS 8 EOL如何切换源?的主要内容,如果未能解决你的问题,请参考以下文章