Document directory
- 1. Install yum
- 2. Modify the. Repo File
- 3. Import key
- 4. Run and Test
- 1. Uninstall RHEL Yum-related packages
- 2. Install the centos Source
Http://weijia.blog.51cto.com/616222/119673 [Source]
Delete the original/etc/yum. conf file and the/etc/yum. Repo. d directory
Generate yum. conf, content
[Root @ localhost etc] # Cat yum. conf
[main]cachedir=/var/cache/yumkeepcache=1debuglevel=2logfile=/var/log/yum.logpkgpolicy=newestdistroverpkg=redhat-releasetolerant=1exactarch=1obsoletes=1gpgcheck=1plugins=1metadata_expire=1800 # PUT YOUR REPOS HERE OR IN separate files named file.repo# in /etc/yum.repos.d[base]name=centos-5 - Basebaseurl=http://centos.ustc.edu.cn/centos/5/os/i386/# the other site: [url]http://centos.candishosting.com.cn/centos/5/os/i386/[/url]# you can find more site in: [url]http://www.centos.org/modules/tinycontent/index.php?id=13[/url]enabled=1gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#released updates[update]name=CentOS-5 - Updatesbaseurl=http://mirror.centos.org/centos/5/updates/i386/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons]name=CentOS-5 - Addonsbaseurl=http://mirror.centos.org/centos/5/addons/$basearch/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-5 - Extrasbaseurl=http://mirror.centos.org/centos/5/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4#additional packages that extend functionality of existing packages[centosplus]name=CentOS-5 - Plusbaseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-5 - Contribbaseurl=http://mirror.centos.org/centos/5/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5#packages in testing[testing]name=CentOS-5 - Testingbaseurl=http://mirror.centos.org/centos/5/testing/$basearch/gpgcheck=1enabled=0gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
2008.07.28 update 1. Install yum2. modify the. Repo File
CCD/etc/yum. Repos. d/
# Vi CentOS-Base.repo
Write the following content:
[Base]
CentOS-5-Base
# Items list = http://mirrorlist.centos.org /? Release = $ releasever5 & arch = $ basearch &
Repo = OS
# Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/
Baseurl = http://ftp.sjtu.edu.cn/centos/5/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Released updates
[Update]
CentOS-5-Updates
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = updates
Baseurl = http://ftp.sjtu.edu.cn/centos/5/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Packages used/produced in the build but not released
[Addons]
CentOS-5-Addons
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = Addons
Baseurl = http://ftp.sjtu.edu.cn/centos/5/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
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = extras
Baseurl = http://ftp.sjtu.edu.cn/centos/5/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Additional packages that extend functionality of existing packages
[Centosplus]
CentOS-5-plus
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = centosplus
Baseurl = http://ftp.sjtu.edu.cn/centos/5/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
# Items list = http://mirrorlist.centos.org /? Release = 4 & arch = $ basearch & repo = contrib
Baseurl = http://ftp.sjtu.edu.cn/centos/5/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# Vi Dag. Repo
[Dag]
Name = Dag RPM repository for rhel5
Baseurl = http://ftp.riken.jp/linux/dag/redhat/el5/en/?basearch/dag/
Enabled = 1
Gpgcheck = 1
Gpgkey = http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
3. Import key
# Rpm -- import [url] restart
4. Run and Test
# Yum update
*****************************
Make rhel5 Yum centos5.1
1. Uninstall RHEL Yum-related packages
[Root @ virhost ~] # Rpm-Qa | grep yum
Yum-updatesd-3.0.1-5.el5
Yum-3.0.1-5.el5
Yum-rhn-plugin-0.5.2-3.el5
Yum-metadata-parser-1.0-8.fc6
Yum-security-1.0.4-3.el5
[Root @ virhost ~] # Yum update
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up update process
Setting up Repositories
No repositories available to set up
Reading repository metadata in from local files
Skipping Security plugin, no data
No packages marked for update/obsoletion
[Root @ virhost ~] # Rpm-e yum-3.0.1-5.el5 -- nodeps
[Root @ virhost ~] # Rpm-Qa | grep yum
Yum-metadata-parser-1.0-8.fc6
Yum-updatesd-3.0.1-5.el5
Yum-rhn-plugin-0.5.2-3.el5
Yum-security-1.0.4-3.el5
[Root @ virhost ~] # Rpm e yum-updatesd-3.0.1-5.el5
[Root @ virhost ~] # Rpm e yum-rhn-plugin-0.5.2-3.el5
[Root @ virhost ~] # Rpm-e yum-metadata-parser-1.0-8.fc6 (later test this should not be uninstalled)
[Root @ virhost ~] # Rpm e yum-security-1.0.4-3.el5
2. Install the centos Source
[Url] URLs
Rpm-IVH yum-3.0.5-1.el5.centos.5.noarch.rpm
[Root @ virhost ~] # Wget [url] http://centos.ustc.edu.cn/centos/5/ OS/I #/centos/yum-3.0.5#/url]-
1. el5.centos. 5. noarch. rpm
[Root @ virhost ~] # Rpm-IVH yum-3.0.5-1.el5.centos.5.noarch.rpm
Warning: yum-3.0.5-1.el5.centos.5.noarch.rpm: Header V3 DSA Signature: nokey, key ID e8562897
Error: Failed dependencies:
Yum-metadata-parser is needed by yum-3.0.5-1.el5.centos.5.noarch
[Root @ virhost ~] # Wget [url] http: // 192.168.1.250/yum-metadata-parser-1.0-8.fc6.i386.rpm [/url]
-- 07:48:55 -- [url] http: // 192.168.1.250/yum-metadata-parser-1.0-8.fc6.i386.rpm [/url]
Connecting to 192.168.1.250: 80... connected.
An HTTP request has been sent and is waiting for response... 200 OK
Length: 22950 (22 K) [text/plain]
Saving to: 'yum-metadata-parser-1.0-8.fc6.i386.rpm'
100% [============================================== =======================>] 22,950 --. -K/S in
0.003 s
07:48:55 (8.57 Mb/s)-'yum-metadata-parser-1.0-8.fc6.i386.rpm 'saved [22950/22950]
[Root @ virhost ~] # Rpm-IVH yum-metadata-parser-1.0-8.fc6.i386.rpm
Warning: yum-metadata-parser-1.0-8.fc6.i386.rpm: Header V3 DSA Signature: nokey, key ID 37017186
Preparing... ######################################## ### [100%]
1: yum-metadata-parser ################################### ####### [1, 100%]
[Root @ virhost ~] # Rpm-IVH yum-3.0.5-1.el5.centos.5.noarch.rpm
Warning: yum-3.0.5-1.el5.centos.5.noarch.rpm: Header V3 DSA Signature: nokey, key ID e8562897
Preparing... ######################################## ### [100%]
1: yum ####################################### #### [100%]
From this it seems that the yum-metadata-parser-1.0-8.fc6.i386.rpm package should not be deleted that
[Root @ virhost ~] # Cd/etc/yum. Repos. d/
[Root @ virhost yum. Repos. d] # ls
Rhel-debuginfo.repo
[Root @ virhost yum. Repos. d] # vi CentOS-Base.repo this file is like below
[Base]
CentOS-5.1-Base
Baseurl = http://developer.tini4u.net/centos/5.1/ OS /?basearch/
[Url] http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/#/url]
Gpgcheck = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5.1/ OS /i386/RPM-GPG-KEY-CentOS-5
# Released updates
[Updates]
CentOS-5.1-Updates
Baseurl = http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/
[Url] http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/#/url]
Gpgcheck = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5.1/ OS /i386/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
CentOS-5.1-Addons
Baseurl = http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/
[Url] http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/#/url]
Gpgcheck = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5.1/ OS /i386/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = CentOS-5.1-extras
Baseurl = http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/
[Url] http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/#/url]
Gpgcheck = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5.1/ OS /i386/RPM-GPG-KEY-CentOS-5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-5.1? C plus
Baseurl = http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/
[Url] http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/#/url]
Gpgcheck = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5.1/ OS /i386/RPM-GPG-KEY-CentOS-5
# Contrib-packages by centos users
[Contrib]
Name = CentOS-5.1-contrib
Baseurl = http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/
[Url] http://centos.ustc.edu.cn/centos/5.1/ OS /?basearch/#/url]
Gpgcheck = 0
Gpgkey = http://centos.ustc.edu.cn/centos/5.1/ OS /i386/RPM-GPG-KEY-CentOS-5
Then I tested a command.
[Root @ virhost yum. Repos. d] # rpm-Qa | grep Postfix
This package is not installed in the system.
[Root @ virhost yum. Repos. d] # Yum install Postfix
Loading "installonlyn" plugin
Setting up install process
Setting up Repositories
Updates 100% | =============================| 1.1 kb
Contrib 100% | =============================| 1.1 kb
Centosplus 100% | =========================| 1.1 kb
Addons 100% | =========================| 1.1 kb
Extras 100% | =============================| 1.1 kb
Reading repository metadata in from local files
Primary.xml.gz 100% | =======================| 834 KB
######################################## ######## 2400/2400
Primary.xml.gz 100% | =======================| 834 KB
######################################## ######## 2400/2400
Primary.xml.gz 100% | =======================| 834 KB
######################################## ######## 2400/2400
Primary.xml.gz 100% | =======================| 834 KB
######################################## ######## 2400/2400
Primary.xml.gz 100% | =======================| 834 KB
######################################## ######## 2400/2400
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for Postfix to pack into transaction set.
Postfix-2.3.3-2.i386.rpm 100% | =================================| 41 KB
---> Package Postfix. i386. 3.3-2 set to be updated
--> Running transaction check
Dependencies resolved
========================================================== ============================================
Package arch version repository size
========================================================== ============================================
Installing:
Postfix i386. 3.3-2 extras 3.6 m
Transaction Summary
========================================================== ============================================
Install 1 package (s)
Update 0 package (s)
Remove 0 p