最近安裝nagios+pnp,各種依賴包啊。rrdtool腫麼裝的這麼費勁,後來實在扛不住了,還是修改rhel的源吧,把yum源搞成centos的不就ok了!哈哈。然後就從網上一頓猛搜,發現“Ayou”老師的文章很靠譜,很有幫助,這裡是看“Ayou”老師的文章搭出來的。雖然不是太難,但是找這個CentOS-Base.repo還是要靠“ayou”老師的文章,是以,感謝下“Ayou”老師。順便推薦“Ayou”老師的部落格,有很多很多好的文章,篇幅很短,但很精練。
由于我的系統環境是x86_64的,“Ayou”老師的路徑是i386的,是以稍微改了一點Ayou老師源位址的路徑,還有一點就是把gpgkey的路徑換成了163的路徑,因為感覺每次通路gpgkey都要去國外的伺服器跑一圈是不是有點繞了。當然把這個gpgkey放在本地也是合适的,但是,個人認為在沒有網際網路通路的情況下,yum源本身就是無法連通的,這個gpgkey也确實就沒有必要存在,是以這裡就沒有拿回本地來。
推薦部落格:http://www.sudone.com/
本文參考:http://sudone.com/linux/rhel5_yum.html
1、解除安裝掉RHEL原有的yum包
- rpm -aq|grep yum|xargs rpm -e --nodeps
2、下載下傳centos的yum安裝檔案
- wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
- wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
- wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
- wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
- 也可用此位址:
- wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
- wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
- wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
- wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
- wget http://sudone.com/download/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo
- key檔案位置可選:
- http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
- http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
3、安裝yum軟體包
- rpm -ivh --nodeps \
- # python-iniparse-0.2.3-4.el5.noarch.rpm \
- yum-3.2.22-39.el5.centos.noarch.rpm \
- yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm \
- yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
4、添加配置檔案
- wget http://sudone.com/download/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo
5、以防萬一,配置檔案全文如下
- # cat /etc/yum.repos.d/CentOS-Base.repo
- ###### 配置檔案完整内容 ######
- [base]
- name=CentOS-5 - Base
- repo=os
- baseurl=http://mirrors.163.com/centos/5/os/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- #released updates
- [update]
- name=CentOS-5 - Updates
- baseurl=http://mirrors.163.com/centos/5/updates/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- #packages used/produced in the build but not released
- [addons]
- name=CentOS-5 - Addons
- baseurl=http://mirrors.163.com/centos/5/addons/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- #additional packages that may be useful
- [extras]
- name=CentOS-5 - Extras
- baseurl=http://mirrors.163.com/centos/5/extras/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS-5 - Plus
- baseurl=http://mirrors.163.com/centos/5/centosplus/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- #contrib - packages by Centos Users
- [contrib]
- name=CentOS-5 - Contrib
- baseurl=http://mirrors.163.com/centos/5/contrib/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
- ###### 配置檔案結束 ######
6、萬事大吉,可以測試了
以下代碼為展示,不用敲,隻為驗證yum是否能連到yum源上。經過下面測試已經可以顯示包了,ok。哈哈。配置完成,
- [root@localhost ~]# yum search httpd
- Loaded plugins: fastestmirror
- Repository base is listed more than once in the configuration
- Repository update is listed more than once in the configuration
- Repository addons is listed more than once in the configuration
- Repository extras is listed more than once in the configuration
- Repository centosplus is listed more than once in the configuration
- Repository contrib is listed more than once in the configuration
- Loading mirror speeds from cached hostfile
- addons | 1.9 kB 00:00
- base | 1.1 kB 00:00
- extras | 2.1 kB 00:00
- update | 1.9 kB 00:00
- ================================ Matched: httpd ================================
- mod_ssl.x86_64 : SSL/TLS module for the Apache HTTP server
- system-config-httpd.noarch : Apache configuration tool
- centos-ds.x86_64 : CentOS Directory, Administration, and Console Suite
- httpd.x86_64 : Apache HTTP Server
- httpd-devel.x86_64 : Development tools for the Apache HTTP server.
- httpd-devel.i386 : Development tools for the Apache HTTP server.
- httpd-manual.x86_64 : Documentation for the Apache HTTP server.
- mod_dav_svn.x86_64 : Apache server module for Subversion server.
- [root@localhost ~]#