rhel配置网络yum源
redhat 7.2配置网易yum源
卸载原来的yum源和安装必须的rpm包
1)确保虚拟机能够连接外网
2)前往http://mirrors.163.com/centos/7/os/x86_64/Packages/下载一下rpm包:
python-iniparse-0.4-9.el7.noarch.rpm
python-urlgrabber-3.10-8.el7.noarch.rpm
yum-3.4.3-150.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
下载适合自己系统的版本
3)wget下载到系统
4)安装之前先卸载到原来的yum源:
命令:rpm -aq|grep yum|xargs rpm -e --nodep
5)查询是否完全卸载完(完了不提示内容)
6)先安装这两包
命令:rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
7)一起安装剩下的连个包(一定要一起安装)
命令:rpm -ivh yum-3.4.3-150.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
8)若果第7步报错
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature,
key ID c105b9de: NOKEY error: Failed dependencies: python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
显示确实依赖包
8)安装确实的依赖:
命令:rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
9)尝试重新进行第7,若果还是报错则证明依赖包没有安装成功,使用命令进行强制安装,之后重新进行第7步
命令:rpm -ivh --force python-urlgrabber-3.10-8.el7.noarch.rpm
更改配置文件
1) 在 /etc/yum.repos.d/rhel-resource.repo下写入以下(前提是你已备份)
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=0
enabled=0
2)清除原来的配置
命令:yum clean all
3)安装现在的yum(测试yum有没有安装成功)
命令:yum install yum
4) 更新yum源到本地
命令:yum list
至此163网络yum源安装完成,参考了此博文