linux笔记 · 2023年10月30日 0

RedHat7.9 yum源替换

RHEL的默认源要注册用户,用不了一点,于是替换成Centos源。

删除自带的yum源:

rpm -aq|grep yum|xargs rpm -e --nodeps

清华源下载所需的rpm包:

安装包:

rpm -ivh *.rpm --nodeps --force

将yum源改为清华源:

cp /etc/yum.repos.d/
mv redhat.repo redhat.repo.bak
vi CentOS7-Base-163.repo

CentOS7-Base-163.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-7 - Base - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=7&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-7

#released updates

[updates]

name=CentOS-7 - Updates - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=7&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-7

#additional packages that may be useful

[extras]

name=CentOS-7 - Extras - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=7&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-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-7 - Plus - 163.com

baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

关闭订阅插件提示:

vi /etc/yum.conf

    pluguins=0

vi /etc/yum/pluginconf.d/subscription-manager.conf

    enable=0

清空yum缓存,并加载清华源缓存:

yum clean all

yum makecache