linux主流軟體管理器-yum

來源:互聯網
上載者:User

linux主流軟體管理器-yum 可用於linux發行版本Fedora,RedHat/centOS,SUSE 1.1yum簡介軟體包管理器Yum(全稱為 Yellow dog Updater, Modified)是一個在Fedora,RedHat,及SUSE、CentOS中的Shell前端軟體包管理器。基於yum包管理,能夠從指定的伺服器自動下載yum包並且安裝,可以自動處理依賴性關係,並且一次安裝所有依賴的軟體包,無須繁瑣地一次次下載、安裝。軟體包來源可供Yum下載的軟體包括Fedora本身的軟體包以及源自yumfusion和yum.livna.org的Fedora Extras,全部是由Linux社區維護的,並且基本是自由軟體。 所有的包都有一個獨立的GPG簽名,主要是為了您的系統安全。而對於Fedora core 4.0 的使用者,yum.livna.org 的簽名是自動匯入並安裝的。圖形化前端Yum的圖形化前端主要有yumex和kyum。它們並不是獨立於Yum的,而是Yum的圖形前端,也就是說在安裝和使用Yumex和kyum同時,都是以Yum的安裝和配置為基礎;所以在用Yumex或kyum 時,必須先安裝配置Yum。---------------------------------------------------------------------------------------------------1.2yum安裝-----------------------------------------------第一種方法:(推薦)第一步:建立一個檔案夾,並把光碟片內的所有檔案複製到這個檔案夾裡:[root@localhost ~]# mkdir /yum[root@localhost ~]# cp -rvf /misc/cd/* /yum第二步:備份repodata檔案。因為有四個檔案夾裡都有這個檔案,所以都要備份。[root@localhost ~]# mv /yum/Server/repodata /yum/Server/repodata.bak[root@localhost ~]# mv /yum/VT/repodata /yum/VT/repodata.bak[root@localhost ~]# mv /yum/Cluster/repodata /yum/Cluster/repodata.bak[root@localhost ~]# mv /yum/ClusterStorage/repodata /yum/ClusterStorage/repodata.bak第三步:安裝工具包:[root@localhost ~]# rpm -ivh /yum/Server/createrepo-0.4.11-3.el5.noarch.rpm第四步:產生倉庫資料庫:[root@localhost ~]# createrepo -g /yum/Server/repodata.bak/comps-rhel5-server-core.xml /yum/Server/[root@localhost ~]# createrepo -g /yum/VT/repodata.bak/comps-rhel5-vt.xml /yum/VT/[root@localhost ~]# createrepo -g /yum/Cluster/repodata.bak/ /yum/Cluster[root@localhost ~]# createrepo -g /yum/ClusterStorage/repodata.bak/comps-rhel5-cluster-st.xml /yum/ClusterStorage/第五步:查看倉庫資料檔案:[root@localhost ~]# ls /yum/Server/repodata/comps-rhel5-server-core.xml //這個檔案軟體包組的分類。filelists.xml.gz other.xml.gz primary.xml.gz //這三個檔案為軟體包列表檔案。repomd.xml //這個檔案為MD5校正資訊。在/yum/VT /yum/Cluster /yum/ClusterStorage下面都有這幾個檔案,作用和這一樣。如果想更新軟體包,只需把下載完的軟體包放在Server或者其他三個目錄裡,再使用第四步重建資料庫檔案即可。第六步:用戶端配置:[root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/chenbin.repo[root@localhost ~]# vi /etc/yum.repos.d/chenbin.repo[rhel-Server]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///yum/Serverenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-VT]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///yum/VTenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-Cluster]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///yum/Clusterenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-ClusterStorage]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///yum/ClusterStorageenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release第七步:查看已經出現軟體列表了。-----------------------------------------------1.2第二種方法:第一步:同上,建立一個新檔案夾,並把光碟片的內容全部複製到該檔案夾內:[root@localhost ~]# mkdir /yum[root@localhost ~]# cp -rvf /misc/cd/* /yum第二步:安裝工具包:[root@localhost ~]# rpm -ivh /yum/Server/createrepo-0.4.11-3.el5.noarch.rpm第三步:產生倉庫資料庫:[root@localhost ~]# cd /yum[root@localhost yum]# createrepo . //注意後面的.第四步:查看檔案:檔案作用同上:[root@localhost yum]# ls /yum/repodata/filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml第五步:用戶端配置:[root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/chenbin.repo[root@localhost ~]# vi /etc/yum.repos.d/chenbin.repo[rhel-chenbin]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///yum/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release清除yum安裝時的緩衝:[root@localhost ~]# yum clean all至此,yum安裝完成,但使用這種方法安裝後在應用程式-添加刪除軟體的列表是空的,但使用yum安裝軟體是可以的。[root@localhost ~]# yum install /yum/Server/httpd-2.2.3-22.el5.i386.rpm[root@localhost ~]# yum remove httpd-----------------------------------------------1.3第三種方法:首先把光碟片放入光碟機內:然後複製設定檔:[root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/chenbin.repo最後編輯設定檔:[root@localhost ~]# vi /etc/yum.repos.d/chenbin.repo[rhel-Server]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///misc/cd/Serverenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-VT]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///misc/cd/VTenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-Cluster]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///misc/cd/Clusterenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-ClusterStorage]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///misc/cd/ClusterStorageenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release清除緩衝:[root@localhost ~]# yum clean all這種方法安裝後在應用程式-添加刪除軟體裡也有列表。同樣可以使用yum安裝缷載[root@localhost ~]# yum install /misc/cd/Server/httpd-2.2.3-22.el5.i386.rpm[root@localhost ~]# yum remove httpd如果把光碟片拿出後,在應用程式-添加刪除軟體就沒有列表了,只要放入光碟片就有。---------------------------------------------------------------------------------------------------YUM常用命令:1.安裝軟體包:yum install packageyum localinstall package 從本機目錄安裝軟體包yum groupinstall group 安裝某個組件的全部軟體包2.更新軟體包:yum update packageyum check-update 列出所有可更新的軟體包yum list updates mysql* 尋找mysql的更新yum update 更新所有可更新的軟體包yum update mysql* 更新所有mysql的軟體包yum groupupdate group 更新某個組件的所有軟體包yum list 列出所有已安裝和倉庫中可用的軟體包yum list available 列出倉庫中所有可用的軟體包yum list updates 列出倉庫中比當前系統更新的軟體包yum list installed 列出已安裝的軟體包yum list recent 列出新加入倉庫的軟體包yum info 查詢軟體包資訊 3.刪除軟體包:yum remove packageyum groupremove group 刪除某個組件的全部軟體包4.清除軟體包yum clean packages 清除遺留在緩衝裡的包檔案yum clean metadata 清除遺留在緩衝裡的中繼資料yum clean headers 清除遺留在緩衝裡的標頭檔yum clean all 清除包檔案,中繼資料,標頭檔5.搜尋軟體包:yum search packageyum info package 尋找一個軟體包的資訊yum list package 列出包含指定資訊的軟體包yum list installed 列出已安裝的軟體包yum list extras 列出不是通過軟體倉庫安裝的軟體包yum list *ttp* 列出標題包含ttp的軟體包yum list updates 列出可以更新的軟體包6.尋找特定檔案是由什麼軟體包提供的:yum whatprovides filename例子:yum whatprovides httpd.conf可用選項–disalberepo=lib 禁用某個軟體倉庫–enalberepo=lib 啟用某個軟體倉庫-C 禁用使用本機緩衝的中繼資料例子:yum –disalberepo=livna|–enalberepo=livna install mplayeryum -C info httpd 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.