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.rpm wget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpmwget 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=os baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=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.com mirrorlist=http://www.atomicorp.com/mirrorlist/atomic/centos-6-$basearch #mirrorlist=http://www.atomicorp.com/channels/atomic/centos/6/mirrors-atomic enabled=1 protect=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt priority=11 ##############################################################
5、epel軟件倉
1、安裝epel yum源
CentOS 5 32位系統:# rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
64位系統:# 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 6 32位系統:# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
64位系統:# 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/$basearch mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 priority=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 - dag baseurl=http://apt.sw.be/redhat/el6/en/$basearch/rpmforge mirrorlist=http://apt.sw.be/redhat/el6/en/mirrors-rpmforge #mirrorlist=file:///etc/yum.repos.d/mirrors-rpmforge enabled=1 protect=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag gpgcheck=1 priority=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.rpm
64位
# 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=$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6 priority=14 #################################################################
8、Percona軟件倉
1、安裝Percona yum源
rpm –ivh http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm rpm --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 - Percona baseurl=http://repo.percona.com/centos/7/os/$basearch/ enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-percona gpgcheck = 1 priority=15
9、安裝完畢後執行如下命令,就可以使用新的yum源管理軟件了。
# yum clean all # yum makecache
9、163軟件倉
1)安裝163 yum源
rpm -ivh http://mirrors.163.com/.help/CentOS6-Base-163.repo rpm --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.com baseurl=http://mirrors.163.com/centos/7/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 priority=16
官網:
http://mirrors.163.com/.help/
10、SCL 源
http://toutiao.com/i6231268237238075906/
五、創建本地軟件庫
http://www.cnblogs.com/xiaoluo501395377/archive/2013/05/21/3089970.html
參考:http://www.linuxdiyf.com/bbs/thread-423690-1-1.html
http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html
Linux yum源完全配置