Linux yum源完全配置

來源:互聯網
上載者:User

Linux yum源完全配置
一、簡介 yum主要功能是更方便的添加/刪除/更新RPM包,自動解決包的依賴性問題,便於管理大量系統的更新問題,其理念是使用一個中心倉庫(repository)管理一部分甚至一個distribution的應用程式相互關係,根據計算出來的軟體依賴關係進行相關的升級、安裝、 刪除等操作,減少了Linux使用者一直頭痛的dependencies的問題。 可以同時配置多個資產庫(Repository),簡潔的設定檔(/etc/yum.conf),自動解決增加或刪除rpm包時遇到的依賴性問題,保持與RPM資料庫的一致性。 二、軟體安裝方法及策略 http://seisman.info/how-to-install-softwares-under-centos-7.html 三、官方源 配置CentOS6官方源,步驟如下: 1)執行如下命令,查看yum包 rpm -qa|grep yum 2)執行如下命令,卸載原有源 rpm -qa | grep yum | xargs rpm -e --nodeps 3)下載新的yum包 wget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-3.2.29-22.el6.centos.noarch.rpmwget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm wget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm 4)執行如下命令,安裝新的yum包 rpm -ivh yum-* 5)下載yum的配置源 wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo 修改配置源,修改後的連結如下: http://download.csdn.net/detail/u011640816/9252933 6)執行如下指令,進行統一更新 cd /etc/yum.repos.d/yum update 四、第三方源 CentOS/RHEL預設的yum軟體倉庫非常有限,僅僅限於發行版本那幾張盤裡面的常規包和一些軟體包的更新,利用RpmForge,可以增加非常多的第三方rpm軟體包. RpmForge庫現在已經擁有超過10000種CentOS的軟體包,被CentOS社區認為是最安全也是最穩定的一個第三方軟體庫.  步驟如下: 1、安裝yum-priorities外掛程式 這個外掛程式是用來設定yum在調用軟體源時的順序的. 因為官方提供的軟體源,都是比較穩定和被推薦使用的. 因此,官方源的順序要高於第三方源的順序. 如何保證這個順序,就需要安裝yum-priorities這外掛程式了. # yum -y install yum-priorities 2、安裝完yum-priorities外掛程式後,需要設定/etc/yum.repos.d/ 目錄下的.repo相關檔案(如CentOS-Base.repo),在這些檔案中插入順序指令:priority=N (N為1到99的正整數,數值越小越優先) 一般配置[base],[addons],[updates],[extras]的priority=1,[CentOSplus],[contrib]的priority=2,其他第三的軟體源為:priority=N (推薦N>10),以CentOS-Base.repo 為例:  ##############################################################[base]name=CentOS-$releasever - Base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osbaseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1############################################################## 3、adobe軟體倉 1、添加adobe軟體倉並匯入密鑰 # rpm -ivh http://linuxdownload.adobe.com/linux/i386/adobe-release-i386-1.0-1.noarch.rpm         #32位# rpm -ivh http://linuxdownload.adobe.com/linux/x86_64/adobe-release-x86_64-1.0-1.noarch.rpm     #64位# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux        #匯入密鑰2、設定/etc/yum.repos.d/中的adobe-linux-x86_64.repo中的priority=10 現在可以安裝adobe的flashplayer外掛程式了 # yum install flash-plugin 4、atomic軟體倉 1、安裝atomic源 # wget http://www.atomicorp.com/installers/atomic  #下載# sh ./atomic   #安裝 2、設定/etc/yum.repos.d/中的atomic.repo中的priority=11 ##############################################################[atomic]name=CentOS / Red Hat Enterprise Linux $releasever - atomicrocketturtle.commirrorlist=http://www.atomicorp.com/mirrorlist/atomic/centos-6-$basearch#mirrorlist=http://www.atomicorp.com/channels/atomic/centos/6/mirrors-atomicenabled=1protect=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txtpriority=11############################################################## 5、epel軟體倉 1、安裝epel yum源 CentOS 532位系統:# rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm64位系統:# rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm匯入key: # rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5 CentOS 632位系統:# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm64位系統:# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm匯入key: # rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 2、設定/etc/yum.repos.d/中的epel.repo中的priority=12 提示:如果用比較新的軟體,用epel-test.repo這個檔案就行了 ###############################################################[epel]name=Extra Packages for Enterprise Linux 6 - $basearch#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearchmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearchfailovermethod=priorityenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6priority=12################################################################# 6、rpmforge軟體倉 1、安裝rpmforge軟體源 # wget http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.i686.rpm     #32位# wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm #64位# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt #2安裝DAG的PGP Key# rpm --import /etc/pki/rpm-gpg/*  #匯入本地的key# rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm    #驗證rpmforge的rpm檔案包# rpm -i rpmforge-release-0.5.3-1.el6.rf.i386.rpm #安裝rpmforge的rpm檔案包 2、設定/etc/yum.repos.d/rpmforge.repo檔案中源的層級,priority=13 ########################################################### Name: RPMforge RPM Repository for RHEL 6 - dag### URL: http://rpmforge.net/[rpmforge]name=RHEL $releasever - RPMforge.net - dagbaseurl=http://apt.sw.be/redhat/el6/en/$basearch/rpmforgemirrorlist=http://apt.sw.be/redhat/el6/en/mirrors-rpmforge#mirrorlist=file:///etc/yum.repos.d/mirrors-rpmforgeenabled=1protect=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-daggpgcheck=1priority=13######################################################## 7、rpmfusion軟體倉 rpmfusion主要為案頭發行版提供大量rpm包,而EPEL則為伺服器版本提供大量的rpm包,而且大多數rpm包在官方repository中是找不到的 1、安裝rpmfusion yum源 32位# rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm# rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm64位# rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6-1.noarch.rpm# rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm 2、設定/etc/yum.repos.d/rpmfusion-free-updates.repo檔案中源的層級,priority=14 #################################################################[rpmfusion-free-updates-testing]name=RPM Fusion for EL 6 - Free - Test Updates#baseurl=http://download1.rpmfusion.org/free/el/updates/testing/6/$basearch/mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-testing-6&arch=$basearchenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6priority=14################################################################# 8、Percona軟體倉 1、安裝Percona yum源 rpm –ivh http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpmrpm --import http://www.percona.com/downloads/percona-release/RPM-GPG-KEY-percona 2、設定/etc/yum.repos.d/Percona .repo檔案中源的層級,priority=15 [percona]name = CentOS $releasever - Perconabaseurl=http://repo.percona.com/centos/7/os/$basearch/                                                                   enabled = 1gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-perconagpgcheck = 1priority=15 9、安裝完畢後執行如下命令,就可以使用新的yum源管理軟體了。 # yum clean all# yum makecache 9、163軟體倉 1、安裝163 yum源 rpm -ivh http://mirrors.163.com/.help/CentOS6-Base-163.reporpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 2、設定/etc/yum.repos.d/CentOS6-Base-163.repo檔案中源的層級,priority=16 [base]name=CentOS-$releasever - Base - 163.combaseurl=http://mirrors.163.com/centos/7/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7priority=16 五、建立本地軟體庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.