RedHat Enterprise企业级Linux系统使用YUM工具需要注册订阅并需要一些花费,此处修改YUM并使用CentOS-Base.repo、epel.repo等YUM源。
此操作并不是破解,请知悉
有些RedHat的功能可能不能使用
安装RedHat Enterprise Linux 7.6
执行yum list未注册
执行卸载yum
# setp1: 卸载yum
rpm -qa | grep yum | xargs rpm -e --nodeps
下载yum包
yum包:
- yum-3.4.3-161.el7.centos.noarch.rpm
- yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
- yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm包,有可能会抛错,需要升级rpm包:rpm-4.11.3-35.el7.x86_64.rpm
# setp1: 升级rpm包
rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm --nodeps
# setp2: 安装yum包
rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
下载CentOS-Base.repo、epel.repo
可以先找一台机器下载然后scp
- epel:wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
- CentOS-Base.repo:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# setp1:
sed -i "s?\$releasever?7?g" /etc/yum.repo.d/CentOS-Base.repo
查找redhat-release
需要卸载此包,否则执行yum upgrade抛出异常错误
# setp1: 查找已安装包中是否有此包
yum list installed | grep redhat-release-server
# setp2:卸载
rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps
清除YUM缓存并重建
# setp1:执行
yum clean all && yum makecache
# setp2: 查看当前yum源
yum repolist all