redhat7 使用163 centos yum源 以及 epel源

注意版本对应关系
1.首先删除redhat原有的yum,因为redhat 原本的yum 没有注册为redhat用户是用不了的。

[root@localhost yum.repos.d]# rpm -aq|grep yum|xargs rpm -e --nodeps #卸载已经安装yum及依赖
[root@localhost yum.repos.d]# rpm -aq|grep yum|xargs #检查yum是否存在

[root@localhost yum.repos.d]#

安装wget

wget 下载安装http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/wget-1.14-15.el7.x86_64.rpm

[root@localhost yum.repos.d]# rpm -ivh /root/wget-1.14-15.el7.x86_64.rpm
警告:/root/wget-1.14-15.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:wget-1.14-15.el7 ################################# [100%]
[root@localhost yum.repos.d]#

检查redhat版本

[root@localhost yum.repos.d]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[root@localhost yum.repos.d]# 

2.下载官方centos的yum 安装包

wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm

wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

3.进行安装yum

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-118.el7.centos.noarch.rpm

yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm

注意最后两个包必需同时安装,否则会相互依赖

4.更新repo文件

mv /etc/yum.repos.d/rhel-debuginfo.repo

/etc/yum.repos.d/rhel-debuginfo.repo.repo.bak

如果没有这个文件就直接创建

sudo nano

/etc/yum.repos.d/rhel-debuginfo.repo

在文件中写入

[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.0.1406/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7

released updates

[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/7.0.1406/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/7.0.1406/extras//$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/7.0.1406/centosplus/$basearch/
gpgcheck=1
enabled=0

保存退出

5 yum clean all

6 yum update 测试。

7 安装 epel 源
sudo yum install epel-release
如果不行就手动下载安装
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

sudo rpm -ivh epel-release-7-5.noarch.rpm
$ sudo yum repolist检查是否安装成功

你可能感兴趣的:(redhat7 使用163 centos yum源 以及 epel源)