Redhat7 安装 yum 直接163下载安装文件

Redhat系统内所有操作都需要root权限完成:

1、第一步清理现有版本yum
rpm -qa|grep yum|xargs rpm -e --nodeps
Redhat7 安装 yum 直接163下载安装文件
注:实测并不需要清理,直接第二步开始就行

2、在 http://mirrors.163.com/centos/7/os/x86_64/Packages/ 中下载下面四个程序:
python-iniparse-0.4-9.el7.noarch.rpm
yum-3.4.3-163.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

3、安装这四个程序
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh --nodeps --force yum-3.4.3-163.el7.centos.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
Redhat7 安装 yum 直接163下载安装文件
4、修改CentOS-Base.repo文件
gedit /etc/yum.repos.d/CentOS-Base.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=KaTeX parse error: Expected 'EOF', got '&' at position 2: 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=KaTeX parse error: Expected 'EOF', got '&' at position 2: 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=KaTeX parse error: Expected 'EOF', got '&' at position 2: 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-7Plus163.combaseurl=http://mirrors.163.com/centos/7/centosplus/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

5、以上步骤已经完成,测试一下yum功能:
yum install xterm
Redhat7 安装 yum 直接163下载安装文件