RHEL5.4學習總結——YUM服務器的搭建與應用

   RHEL5.4學習總結——YUM服務器的搭建與應用

YUM簡介:YUM = Yellow dog Updater, Modified,主要功能是方便RPM包的添加、刪除及更新,它能自動解決包的倚賴性問題,可以同時配置多個資源庫(Repository), yum的關鍵之處是要有可靠的repository,顧名思義,就是軟件的倉庫,它可以是http或ftp站點,也可以是本地軟件池,但必須包含rpm的header,header包括了rpm包的各種信息,包括描述,功能,提供的文件,依賴性等
YUM配置:YUM準備工作及服務器的配置
1、首先建立一個本地軟件池,存放更新的軟件包
 
2、掛載CD-ROM並將其所有內容複製到/yumroot下
 
3、切換到 /yumroot目錄
   刪除*.html
   刪除Server/repodata/TRANS.TBL
   刪除VT/repodata/TRANS.TBL
   如果你不刪除以上文件也可能成功,但是也有可能出現意想不到的問題。建議刪除
4、安裝createrepo工具,然後用這個工具生成YUM通用數據庫
[root@redfeng1 yumroot]# createrepo -g /yumroot/Server/repodata/comps-rhel5-server-core.xml /yumroot/Server/
[root@redfeng1 yumroot]# createrepo -g /yumroot/VT/repodata/comps-rhel5-server-core.xml /yumroot/VT/
YUM客戶端的配置

    Linux YUM配置信息都儲存在一個叫yum.conf的配置文件中,通常位於/etc目錄下, 具體內容如下:

[root@redfeng1 ~]# vi /etc/yum.conf

[main]                 //YUM服務器主配置文件

cachedir=/var/cache/yum     //Linux YUM配置緩存的目錄

keepcache=0            

debuglevel=2          //除錯級別,0-10,默認是2

logfile=/var/log/yum.log        //日誌文件

distroverpkg=redhat-release//指定一個軟件包,根據這個包判斷你的發行版本,默認是redhat-release

tolerant=1       //有兩個選項 0 1

exactarch=1       //有兩個選項 0 1

obsoletes=1

gpgcheck=1

plugins=1

# Note: yum-RHN-plugin doesn't honor this.

metadata_expire=1h

# Default.

# installonly_limit = 3

# PUT YOUR REPOS HERE OR IN separate files named file.repo

# in /etc/yum.repos.d

    另外在/etc/yum.repo.d/目錄下存放着的是YUM的服務器配置,所有服務器都應該遵循如下格式,這是整個Linux YUM配置系統的重中之重

[root@redfeng1 ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo

[Server]     //用於區別各個不同的資源庫,必須獨一無二

name=Red Hat Enterprise Linux   //對資源庫進行描述

baseurl=file:///yumroot/Server   //倉庫的位置,對於本地資源庫必須這樣寫

enabled=1             //是否啓用這個倉庫,1爲起用,0爲禁用

gpgcheck=1 //是否檢查GPG簽名(用來驗證要安裝的包是不是REDHAT官方的)

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release//存放簽名地址

[VT]

name=Red Hat Enterprise Linux

baseurl=file:///yumroot/VT

enabled=1

gpgcheck=1


YUM測試

   到此爲止YUM的相關配置基本完成,下面進行YUM測試:

root@redfeng1 ~#yum [option] [工作項目] [軟件]

 Option,主要的參數包括:

   --installroot=/some/path:選擇安裝路徑

   -Y:YUM詢問用戶的意見時,主動回答yes而不需要用戶輸入

 工作項目]包括以下幾個:
  Install :指定安裝的軟件名稱
  Update :進行軟件的升級
  Remove :移除某個軟件


  Clean :清除下載到/var/cache/yum/的項目
  packages|headers|metadata|cache
  List :
列出目前YUM所管理的所有軟件的名稱與版本

  Groupinstall :組安裝

安裝vsftpd

[root@redfeng1 ~]# yum install vsftpd*

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package vsftpd.i386 0:2.0.5-16.el5 set to be updated

Server/filelists                                                                                                       | 2.4 MB     00:00

VT/filelists                                                                                                           |  27 kB     00:00

--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================

 Package                  Arch                 Version                                  Repository               Size

==============================================================================================================================================

Installing:

 vsftpd                 i386                      2.0.5-16.el5                             Server                 140 k

Transaction Summary

==============================================================================================================================================

Install      1 Package(s)

Update       0 Package(s)

Remove       0 Package(s)

Total download size: 140 k

Is this ok [y/N]: y   

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing     : vsftpd                1/1

Installed:

vsftpd.i386 0:2.0.5-16.el5 

 Complete!

 
總結:朋友們!不在學習的時候感覺學習可累可累了,哈!一旦你學起來了,並且成功完成學習任務的時候才感覺,學習也是一種享受,一種樂趣,今天的YUM服務器到此就結束了,儘管我用的本地作爲Repository。朋友們可以試一下FTP,HTTP以及光盤都是可以的,好了,博主再次聲明,博文僅爲學習交流,敬請指正共同提高。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章