Method 1: 1. Configure the yum. conf terminal and enter the following command sudochmod + wetcyum. confsudogeditetcyum. conf to configure yum. conf as follows:
Method 1:
1. Configure yum. conf
Enter the followingCommand
SuDoChmod+ W/etc/yum. conf
Sudo gEdIt/etc/yum. conf
Configure yum. conf as follows:
[Main]
Cachedir =/var/cache/yum
Debuglevel = 2
LogFile=/Var/log/yum. log
Pkgpolicy = newest
DisTrOverpkg = redhat-release
Tolerant = 1
ExActarch = 1
[Base]
Name = Red Hat Linux $ releasever-$ basearch-Base
Base url = http://centos.ustc.edu.cn/centos/5.4/ OS /i386/
[UpDateS]
Name = Red Hat Linux $ releasever-Updates
Base url = http://mirror.centos.org/centos/5.4/updates/i386/
Save and exit.
2. Test
Enter the command: yum update on the terminal
Check the effect!
Method 2:
1. View and delete the currently installed YUM Software Package
View
Enter the following command in the terminal:
Rpm-qa |GrepYum
The YUM package you have installed will appear on the screen.
Delete
Rpm-e XXXXXXXXX (the installed package is displayed just now) -- nodeps
You can delete all installed packages.
If you don't believe it, you can use the command in step 1.
2. Download The centos yum package and install it.
Download
Download and install the downloaded file from http://centos.ustc.edu.cn/centos/5.4/ OS/I #/centos/
Yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
Yum-3.2.22-20.el5.centos.noarch.rpm
Yum-updatesd-0.9-2.el5.noarch.rpm
Or find an FTP site to download it with wget:
# Wget ftp://ftp.pdc.kth.se/pub/bambi/centos/5.4/ OS /i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
# Wget ftp://ftp.pdc.kth.se/pub/bambi/centos/5.4/ OS /i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
# Wget ftp://ftp.pdc.kth.se/pub/bambi/centos/5.4/ OS /i386/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm
Enter the folder where you downloaded the above files on the terminal. I am/root/download/and install the downloaded package.
#Cd/Root/download/
# Rpm-ivh yum *. rpm
You can see the installation progress.
3. Modify your own CentOS-Base.repo
# Cd/etc/yum. repos. d
#MvRhel-debuginfo.repo rhel-debuginfo.repo.bak (Back Up Original profile)
Create a file named CentOS-Base.repo and configure it as follows:
# CentOS-Base.repo
#
# This file uses a new secure list system developed by LaNcE Davis for CentOS.
# The mirror system uses the connecting IPDdRess of the client and
# UpdateStatUs of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You shoshould use this for CentOS updates
# UnLessYou are manually picking other mirrors.
#
# If the specified list = does not work for you, as a fall back you can try
# Remarked out baseurl = line instead.
#
#
[Base]
Name = CentOS-$ releasever-Base
Base url = http://centos.ustc.eDu. Cn/centos/5.4/OS/$ basearch/
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
# ReleaSedUpdates
[Updates]
Name = CentOS-$ releasever-Updates
Baseurl = http://centos.ustc.edu.cn/centos/5.4/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
Name = CentOS-$ releasever-Addons
Baseurl = http://centos.ustc.edu.cn/centos/5.4/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = CentOS-$ releasever-Extras
Baseurl = http://centos.ustc.edu.cn/centos/5.4/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-$ releasever-Plus
Baseurl = http://centos.ustc.edu.cn/centos/5.4/centosplus/?basearch/
Gpgcheck = 1
EnableD = 0
Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
NOTE: If ~
4. Import the KEY file. Note the case sensitivity.
Rpm -- import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
Or
Rpm -- import http://centos.arcticnetwork.ca/5.4/ OS /i386/RPM-GPG-KEY-CentOS-5
5. Test
# Yum update
Coming out ~
[Root @ localhost download] # yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Addons | 951 B 00: 00
Addons/primary | 201 B: 00
Base | 2.1 kB
Base/primary_db | 1.6 MB
Extras | 1.1 kB: 00
Extras/primary | 107 kB: 00
Extras 325/325
Updates | 1.9 kB: 00