The yum Network Resources of RedHat Linux are not as good as CentOS. Therefore, You Need To uninstall yum and download and install centOS yum first.
The following is the installation of centos 5. For more information, see install centos6
1. Download centos yum and use centos 5
Before downloading, you 'd better open the idea in your browser,
# Wget http://centos.ustc.edu.cn/centos/5/ OS /i386/CentOS/yum-3.2.22-33.el5.centos.noarch.rpm
# Wget http://centos.ustc.edu.cn/centos/5/ OS /i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
# Wget http://centos.ustc.edu.cn/centos/5/ OS /i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
2. Find the current yum program and uninstall it.
# Rpm-qa | grep yum
# Rpm-e yum-3.2.22-20.el5 -- nodeps
# Rpm-e yum-updatesd-0.9-2.el5 -- nodeps
# Rpm-e yum-security-1.1.16-13.el5 -- nodeps
# Rpm-e yum-metadata-parser-1.1.2-3.el5 -- nodeps
# Rpm-e yum-rhn-plugin-0.5.4-13.el5 -- nodeps
3. Download and import the KEY
# Cd/etc/pki/rpm-gpg/
# Wget http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# Rpm -- import/etc/pki/rpm-gpg/RPM-GPG-KEYCentOS-5
4. Install the yum installation package
Rpm-ivh yum-3.2.22-33.el5.centos.noarch.rpm \
Yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm \
Yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
5. Create a configuration file
Vi/etc/yum. repos. d/local. repo (or directly open the created local. repo in the text editor, copy and paste the following content)
[Base]
Name = Red Hat Enterprise Linux $ releasever-Base
Baseurl = http://mirrors.sohu.com/centos/5.5/ OS /?basearch/
Gpgcheck = 1
[Update]
Name = Red Hat Enterprise Linux $ releasever-Updates
Baseurl = http://mirrors.sohu.com/centos/5.5/updates/?basearch/
Gpgcheck = 1
[Extras]
Name = Red Hat Enterprise Linux $ releasever-Extras
Baseurl = http://mirrors.sohu.com/centos/5.5/extras/?basearch/
Gpgcheck = 1
[Addons]
Name = Red Hat Enterprise Linux $ releasever-Addons
Baseurl = http://mirrors.sohu.com/centos/5.5/addons/?basearch/
Gpgcheck = 1
So far yum installation is complete,
Before installing the yum install program, you 'd better enter the following command
# Yum clean all
# Yum update
The red background or red text indicates that these should be changed based on the version listed on the website, or based on the Local Computer path or something.
Recommended reading:
RedHat Linux local yum source configuration
RedHat 6.2 modify yum source in Linux use CentOS source for free
Configure the epel yum Source
Redhat local yum source configuration
Description of yum configuration file
Install yum in RedHat 6.1)
YUM installation and cleaning