歡迎您光臨本站 註冊首頁

RHCE5中構建yum倉庫

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

RHCE5中構建yum倉庫

     在RHCE5中構建yum倉庫(整理也是一種收穫)
                        製作:chinanpt
                                    QQ:350072715
在Red Hat Enterprise Linux 5中在安裝時沒有選擇所有軟體包,以後在使用過程中想再增加缺少的軟體包,通常情況可以通過兩種途徑完成。
一、是通過rpm手工安裝需要安裝的軟體包;
二、是通過註冊RHN,然後由yum通過internet連接到RHN站來新增軟體包。
這兩種情況都有其不便之外,第一種由於存在軟體包的依賴性關係,可能需要在安裝一個rpm包之前要安裝多個與之關聯的軟體包,而往往這些依賴的包的名稱我們無法正確定位。尤其經常提示缺乏某一動態函數庫時,我們就不容易方便查到所需軟體包的名稱。第二種方法雖然不存在上述情況,但顯而易見的問題是需要連接 internet,而且安裝軟體包的速度會很慢。
為了避免上述兩種情況的弊端,我們可以通過自己創建本地的repository(倉庫)的方法來實現軟體包的快速安裝。(此方法前提是你有Red Hat Enterprise Linux 5安裝介質盤)
1.        創建掛載點
mkdir /yum
2.        掛載安裝介質盤
mount /dev/cdrom /mnt
3.        複製光碟內容到/yum目錄中
cp /mnt/* /yum
4.        安裝創建repository的軟體包
   rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm
5.        把/yum/repodate目錄下的所有內容移動到指定的位置/home/repodate
mv /yum/Server/repodata/*把系統原有的存放repository內容的目錄改名
6.        創建自己的repository(給yum創建軟體庫)
  createrepo –g /home/repodate/comps-rhel5-server-core.xml /yum/Server/ repodate
7.        修改yum的repository配置文件,指定baseurl路徑為本地file。
cd /etc/yum.repos.d
vi rhel51-server.repo,修改的內容如下

name=Red Hat Enterprise Linux $releasever - $basearch
baseurl=file:///yum/Server
enable=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
8.        如果還想實現更新庫的功能,只需要把從RHN下載的新的軟體包copy到Server目錄下,再運行createrepo命令更新庫內容就可以了
9.        測試:安裝安裝vsftp軟體包
# yum install vsftpd
Failed to set locale, defaulting to C
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vsftpd to pack into transaction set.
vsftpd-2.0.5-10.el5.i386. 100% |=========================|  17 kB    00:00     
---> Package vsftpd.i386 0:2.0.5-10.el5 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
vsftpd                  i386       2.0.5-10.el5     Server            137 k

Transaction Summary
=============================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 137 k
Is this ok : y
Downloading Packages:
Running Transaction Test
warning: vsftpd-2.0.5-10.el5: Header V3 DSA signature: NOKEY, key ID 37017186
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: vsftpd                                                 warning: /etc/logrotate.d/vsftpd.log created as /etc/logrotate.d/vsftpd.log.rpmnew
  Installing: vsftpd                                                 warning: /etc/pam.d/vsftpd created as /etc/pam.d/vsftpd.rpmnew
  Installing: vsftpd                                                 warning: /etc/vsftpd/ftpusers created as /etc/vsftpd/ftpusers.rpmnew
  Installing: vsftpd                                                 warning: /etc/vsftpd/user_list created as /etc/vsftpd/user_list.rpmnew
  Installing: vsftpd                                                 warning: /etc/vsftpd/vsftpd.conf created as /etc/vsftpd/vsftpd.conf.rpmnew
  Installing: vsftpd                                                 warning: /etc/vsftpd/vsftpd_conf_migrate.sh created as /etc/vsftpd/vsftpd_conf_migrate.sh.rpmnew
  Installing: vsftpd                       #########################

Installed: vsftpd.i386 0:2.0.5-10.el5
Complete!
#
10.        測試:卸載vsftpd
# yum remove vsftpd
Failed to set locale, defaulting to C
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package vsftpd.i386 0:2.0.5-10.el5 set to be erased
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
vsftpd                  i386       2.0.5-10.el5     installed         283 k

Transaction Summary
=============================================================================
Install      0 Package(s)         
Update       0 Package(s)         
Remove       1 Package(s)         

Is this ok : y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Removing  : vsftpd                       #########################

Removed: vsftpd.i386 0:2.0.5-10.el5
Complete!
#
11.        總結:yum倉庫的構建還是比較簡單的,沒有多大的難度,這篇文章同時也借鑒了網路中的文章,然後自己有重新的整理了一下!
《解決方案》

回復 #1 chinanpt 的帖子

同感,關鍵步驟就是製作倉庫文件,和建立列表文件
這個確實是比較的使用,尤其是維護很多REDHAT伺服器的時候,
不過centos是沒有這樣的問題的
centos採用了和ubuntu類似的方式就是在互聯網上建立有軟體倉庫,redhat是商業版本銷售,這個基於互聯網的軟體倉庫也是有的,不過就是商業訂閱。
感興趣可以加到我的QQ
《解決方案》

這個也挺有用得,收藏下~
《解決方案》

RHCE5中構建YUM倉庫??????標題有問題吧?!
《解決方案》

原帖由 jerrywjl 於 2008-9-30 19:45 發表 http://linux.chinaunix.net/bbs/images/common/back.gif
RHCE5中構建YUM倉庫??????標題有問題吧?!
呵呵估計是筆誤
RHEL5的本地源。、
《解決方案》

可能是筆誤,不過寫得挺好收藏先
《解決方案》

庫函數文件 是以什麼結尾的 怎麼裡面都是rpm包:em14:  我菜鳥
《解決方案》

好文章,有空實踐一下!!!!!!!!!!
《解決方案》

不錯 辛苦樓主了
《解決方案》

明天實踐下,檢驗下效果哈哈。

[火星人 ] RHCE5中構建yum倉庫已經有586次圍觀

http://coctec.com/docs/service/show-post-16922.html