red hat enterprise linux yum,Red Hat Enterprise Linux7.x(RHEL7.x)更换CentOS YUM源

Red Hat Enterprise Linux7.x(RHEL7.x)更换CentOS YUM源

Red Hat Enterprise Linux7.x(RHEL7.x) change CentOS YUM repository

Red Hat Enterprise Linux 7.1.1503(RHEL 7.1.1503)更换CentOS YUM源

由于RHEL的yum在线更新是收费的,RedHat在没有订阅授权的情况下是不能通过yum下载任何软件的,想使用RHEL系统,还想用yum源来在线安装软件,就需要更换成CentOS YUM源。

#cat /etc/redhat-release //查看版本

Red Hat Enterprise Linux Server release 7.1 (Maipo)

1、删除RHEL原有的yum

rpm -aq|grep yum|xargs rpm -e --nodeps //删除RHEL原有的yum

sudo rpm -ivh http://mirrors.ustc.edu.cn/centos/7.1.1503/os/x86_64/Packages/wget-1.14-10.el7_0.1.x86_64.rpm //安装wget

2、安装CentOS的yum

下载

wget http://mirrors.ustc.edu.cn/centos/7.1.1503/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

wget http://mirrors.ustc.edu.cn/centos/7.1.1503/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://mirrors.ustc.edu.cn/centos/7.1.1503/os/x86_64/Packages/yum-3.4.3-125.el7.centos.noarch.rpm

wget http://mirrors.ustc.edu.cn/centos/7.1.1503/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-29.el7.noarch.rpm

安装

rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

rpm -ivh yum-3.4.3-125.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-29.el7.noarch.rpm

3、下载源文件(CentOS 7)

https://lug.ustc.edu.cn/wiki/mirrors/help/centos //下载页面,根据需要进行下载

4、编辑源文件 CentOS-Base.repo

$releasever 替换成相应的版本号

$basearch 替换成想要的系统位数

编辑源文件 CentOS-Base.repo

http://mirrors.ustc.edu.cn/centos/7.1.1503/ //$releasever替换为7.1.1503 $basearch替换为x86_64,建议国内用户使用

http://mirror.vtti.vt.edu/centos/7.1.1503/ //$releasever替换为7.1.1503 $basearch替换为x86_64,建议国外用户使用

5、导入GPG key

sudo rpm --import http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-7 //导入GPG key

sudo rpm --import http://mirror.vtti.vt.edu/centos/RPM-GPG-KEY-CentOS-7 //导入GPG key

6、安装扩展源

yum -y install epel-release //安装 Extra Packages for Enterprise Linux (EPEL)

yum clean all //清除YUM缓存

yum makecache //创建YUM缓存

yum repolist all //列出全部repository列表

http://mirrorlist.centos.org/?release=7.1.1503&arch=x86_64&repo=os

发现最适合自己的源

完成

你可能感兴趣的:(red,hat,enterprise,linux,yum)