1. Enter the centos system as the root user.
[Root @ xuxy ~] # Cd/etc/yum. Repos. d
2. Backup Repo
[Root @ xuxy yum. Repos. d] # Music CentOS-Base.repo CentOS-Base.repo.bak
3. Create a New CentOS-Base.repo file: (take centos 5.3 as an example)
[Root @ xuxy yum. Repos. d] # vi CentOS-Base.repo
The content is as follows:
[ Base ]
Name = centos-5-Base
# Configure list = http://List.centos.org /? Release = $ releasever5 & arch = $ basearch &
Repo = OS
# Baseurl = http://Mirror.centos.org/centos/?releasever/ OS /?basearch/
Baseurl = http://Ftp.sjtu.edu.cn/centos/5.3/ OS /?basearch/
Gpgcheck =1
Gpgkey = http://Mirror.centos.org/centos/rpm-gpg-key-centos5
# Released updates
[Update]
Name = centos-5-Updates
# Configure list = http://List.centos.org /? Release = 4 & arch = $ basearch & repo = updates
Baseurl = http://Ftp.sjtu.edu.cn/centos/5.3/updates/?basearch/
Gpgcheck =1
Gpgkey = http://Mirror.centos.org/centos/rpm-gpg-key-centos5
# Packages used/producedInThe build but not released
[Addons]
Name = centos-5-Addons
# Configure list = http://List.centos.org /? Release = 4 & arch = $ basearch & repo = Addons
Baseurl = http://Ftp.sjtu.edu.cn/centos/5.3/addons/?basearch/
Gpgcheck =1
Gpgkey = http://Mirror.centos.org/centos/rpm-gpg-key-centos5
# Additional packages that may be useful
[Extras]
Name = centos-5-Extras
# Configure list = http://List.centos.org /? Release = 4 & arch = $ basearch & repo = extras
Baseurl = http://Ftp.sjtu.edu.cn/centos/5.3/extras/?basearch/
Gpgcheck =1
Gpgkey = http://Mirror.centos.org/centos/rpm-gpg-key-centos5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = centos-5-Plus
# Configure list = http://List.centos.org /? Release = 4 & arch = $ basearch & repo = centosplus
Baseurl = http://Ftp.sjtu.edu.cn/centos/5.3/centosplus/?basearch/
Gpgcheck =1
Enabled =0
Gpgkey = http://Mirror.centos.org/centos/rpm-gpg-key-centos5
# Contrib-packages by centos users
[Contrib]
Name = centos-5-Contrib
# Configure list = http://List.centos.org /? Release = 4 & arch = $ basearch & repo = contrib
Baseurl = http://Ftp.sjtu.edu.cn/centos/5.3/contrib/?basearch/
Gpgcheck =1
Enabled =0
Gpgkey = http://Mirror.centos.org/centos/rpm-gpg-key-centos5
(Save and exit: WQ)
Now yum is available. Pai_^
If it cannot be run, load
Yum- 3.2 . 19 - 18 . E15.centos. noarch. rpm
That is, execute the command
# Rpm-IVH Yum- 3.2 . 19 - 18 . E15.centos. noarch. rpm
If you cannot run it, downloadYum-metadata-parser-1.1.2-2.el5.i386.rpmAndYum-3.2.19-18.el5.centos.noarch.rpmAnd install these two files.
That is, execute the command
# Rpm-IVH Yum- 3.2 . 19 - 18 . El5.centos. noarch. rpm
# Rpm-IVH Yum-metadata-parser-1.1.2-2. El5.i386. rpm
In this way, yum can be run. I tried it myself !!