yum的安裝與配置
如果機器上沒有yum首先安裝yum
centos6的源
一.配置本地yum源
二:.配置網路yum源
3.配置其它yum源
一般碰到需要安裝包什麼的需求時我一般都是這樣做的:
本地yum源安裝>epel/remi源安裝>其它yum源安裝
按這個步驟一般的安裝包問題或者依賴關係基本都能解決~~~
-
下載新的yum包
-
64位linux系統下載安裝包
-
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
-
32位linux系統下載安裝包
-
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
-
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
- wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
centos6的源
# rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
注:這一步要兩個一起安裝,要不會會出現如下錯誤:
點選(此處)摺疊或開啟
- 方法略~~~
二:.配置網路yum源
- 1.配置epel源
-
-
1.如果你使用的是RHEL6.x,CentOS6.x,Scientific6.x等6.x的RHEL系linux的話,執行:
-
-
[root@test ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
-
-
2.如果你使用的是5.x系列的,執行:
-
-
[root@test ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
-
-
3.如果你使用的是4.x系列的,執行:
-
-
[root@test ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
-
-
其實上面安裝的那個包就是在你係統/etc/yum.repos.d/下釋放了2個yum源的repo檔案而已:
-
-
/etc/yum.repos.d/epel.repo 正式版,所有的軟體都是穩定可以信賴的
-
/etc/yum.repos.d/epel-testing.repo 測試版
-
但是預設情況下,只有正式版是有效狀態的,如果你想試試測試版的話,需要修改/etc/yum.repos.d/epel-testing.repo,把enabled=0改成enabled=1即可。
-
-
另外,如果你要使用yumdownloader來下載src.rpm包的話,需要把epel.repo裡[epel-source]域下的enabled=0也改成enabled=1即可。
-
-
當然了,如果你暫時不想使用EPEL的yum源的話,把對應檔案裡的enabled=1改成enabled=0就行了,如果你完全不需要了,那就直接解除安裝掉:
-
- [root@test ~]# rpm -e epel-release 刪除epel源
- [root@test ~]# yum repolist 檢視epel源的具體資訊
- [root@test ~]# yum install -y htop 測試一下看可不可以
-
-
- 2.配置remi源
-
-
獲取安裝包
-
[root@test ~]# #wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
-
-
[root@test ~]# rpm -ivh remi-release-5.rpm
-
-
在 /etc/yum.repos.d/下釋放了1個yum源的repo檔案
-
[root@gc1.cuug.net: /etc/yum.repos.d]$ ls
CentOS-Base.repo epel.repo epel-testing.repo remi-release-5.rpm remi.repo yum.repo.old
-
-
當有多個repo源的時候我們可以指定yum源來安裝軟體
-
[root@gc1.cuug.net: /etc/yum.repos.d]$ yum --enablerepo=remi repolist
-
Loaded plugins: fastestmirror
-
Loading mirror speeds from cached hostfile
-
* epel: mirror01.idc.hinet.net
-
* remi: rpms.remirepo.net
-
repo id repo name status
-
addons CentOS-5 - Addons 0
-
base CentOS-5 - Base 2,791
-
epel Extra Packages for Enterprise Linux 5 - i386 5,461
-
extras CentOS-5 - Extras 272
-
remi Les RPM de remi pour Enterprise Linux 5 - i386 1,937
-
update CentOS-5 - Updates 418
- repolist: 10,879
-
獲取安裝包
-
-
安裝好後可以檢視以下remi的php和mysql版本,都提供有5.5版,但php5.5由remi-test提供,生產環境請慎用:
-
yum --enablerepo=remi-test,remi list php mysql
-
remi-test和remi源預設是不開啟的,需要透過--enablerepo引數指定,把/etc/yum.repos.d/remi.repo裡對應的[remi]和[remi-test]塊下的enabled=0改為enabled=1則為預設開啟.
-
epel源則有fedora社群維護,裡面有很多centos官方源沒有的軟體,比如非常實用的命令列介面工作管理員htop:
-
yum --enablerepo=epel -y install htop
- 可以省略--enablerepo=epel,因為epel預設是開啟,而epel-testing是預設不開啟的,要預設開啟,修改同上.
3.配置其它yum源
點選(此處)摺疊或開啟
-
-
1>centos的配置源
-
-
-
下載yum的配置源
-
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo 下載到 /etc/yum.repos.d/ 目錄下面
- 執行yum makecache生成快取
-
下載yum的配置源
-
-
- 或者使用手工的方法配置
-
-
配置yum更新源
-
建立/etc/yum.repos.d/CentOS-Base.repo檔案,定義yum更新源,這裡使用的是上海交大的CentOS更新源
-
[root@linux-a ~]# vi /etc/yum.repos.d/CentOS-Base.repo
-
[base]
-
name=CentOS-5-Base
-
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
-
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
-
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
-
gpgcheck=0
-
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
-
#released updates
-
[update]
-
name=CentOS-5-Updates
-
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
-
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
-
gpgcheck=0
-
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
-
#packages used/produced in the build but not released
-
[addons]
-
name=CentOS-5-Addons
-
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
-
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
-
gpgcheck=0
-
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
-
#additional packages that may be useful
-
[extras]
-
name=CentOS-5-Extras
-
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
-
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
-
gpgcheck=0
-
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
-
#additional packages that extend functionality of existing packages
-
[centosplus]
-
name=CentOS-5-Plus
-
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
-
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
-
gpgcheck=0
-
enabled=0
-
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
-
#contrib - packages by Centos Users
-
[contrib]
-
name=CentOS-5-Contrib
-
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
-
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
-
gpgcheck=0
-
enabled=0
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
-
# vi dag.repo
-
[dag]
-
name=Dag RPM Repository for RHEL5
-
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
-
enabled=1
-
gpgcheck=0
-
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
-
-
匯入key
-
[root@linux-a ~]# rpm --import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
-
-
執行YUM,測試
-
[root@linux-a ~]# yum install xmms-mp3
-
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.
-
---> Package xmms-mp3.i386 1:1.2.10-16.el5.rf set to be updated
-
--> Running transaction check
-
--> Processing Dependency: libglib-1.2.so.0 for package: xmms-mp3
-
--> Processing Dependency: libgdk-1.2.so.0 for package: xmms-mp3
-
--> Processing Dependency: libgthread-1.2.so.0 for package: xmms-mp3
-
--> Processing Dependency: libgmodule-1.2.so.0 for package: xmms-mp3
-
--> Processing Dependency: libgtk-1.2.so.0 for package: xmms-mp3
-
--> Processing Dependency: libxmms.so.1 for package: xmms-mp3
-
--> Restarting Dependency Resolution with new changes.
-
--> Populating transaction set with selected packages. Please wait.
-
---> Package xmms.i386 1:1.2.10-14.el5.rf set to be updated
-
---> Package glib.i386 1:1.2.10-20.el5 set to be updated
-
---> Downloading header for gtk+ to pack into transaction set.
-
gtk+-1.2.10-56.el5.i386.r 100% |=========================| 25 kB 00:00
-
---> Package gtk+.i386 1:1.2.10-56.el5 set to be updated
-
--> Running transaction check
-
--> Processing Dependency: libmikmod.so.2 for package: xmms
-
--> Processing Dependency: gdk-pixbuf >= 0.18.0 for package: gtk+
-
--> Restarting Dependency Resolution with new changes.
-
--> Populating transaction set with selected packages. Please wait.
-
---> Downloading header for gdk-pixbuf to pack into transaction set.
-
gdk-pixbuf-0.22.0-25.el5. 100% |=========================| 16 kB 00:00
-
---> Package gdk-pixbuf.i386 1:0.22.0-25.el5 set to be updated
-
---> Downloading header for mikmod to pack into transaction set.
-
mikmod-3.1.6-38.1.i386.rp 100% |=========================| 7.7 kB 00:00
-
---> Package mikmod.i386 0:3.1.6-38.1 set to be updated
-
--> Running transaction check
-
Dependencies Resolved
-
=============================================================================
-
Package Arch Version Repository Size
-
=============================================================================
-
Installing:
-
xmms-mp3 i386 1:1.2.10-16.el5.rf dag 179 k
-
Installing for dependencies:
-
gdk-pixbuf i386 1:0.22.0-25.el5 base 231 k
-
glib i386 1:1.2.10-20.el5 base 137 k
-
gtk+ i386 1:1.2.10-56.el5 base 923 k
-
mikmod i386 3.1.6-38.1 base 201 k
-
xmms i386 1:1.2.10-14.el5.rf dag 2.3 M
-
Transaction Summary
-
=============================================================================
-
Install 6 Package(s)
-
Update 0 Package(s)
-
Remove 0 Package(s)
-
Total download size: 3.9 M
- Is this ok [y/N]:
-
配置yum更新源
-
-
-
2>其它常用yum源
-
網易(163)yum源是國內最好的yum源之一 ,無論是速度還是軟體版本,都非常的不錯,將yum源設定為163yum,可以提升軟體包安裝和更新的速度,同時避免一些常見軟體版本無法找到。具體設定方法如下:
-
1,進入yum源配置目錄
-
cd /etc/yum.repos.d
-
2,備份系統自帶的yum源
-
mv CentOS-Base.repo CentOS-Base.repo.bk
-
下載163網易的yum源:
-
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
-
3,更新玩yum源後,執行下邊命令更新yum配置,使操作立即生效
-
yum makecache
-
4,除了網易之外,國內還有其他不錯的yum源,比如中科大和搜狐的,大家可以根據自己需求下載
-
中科大的yum源:
-
wget http://centos.ustc.edu.cn/CentOS-Base.repo
-
sohu的yum源
-
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
- 理論上講,這些yum源redhat系統以及fedora也是可以用 的,但是沒有經過測試,需要的站長可以自己測試一下
一般碰到需要安裝包什麼的需求時我一般都是這樣做的:
本地yum源安裝>epel/remi源安裝>其它yum源安裝
按這個步驟一般的安裝包問題或者依賴關係基本都能解決~~~
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29096438/viewspace-1785734/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 7 yum 安裝與配置 JDKCentOSJDK
- CentOS 7 yum 安裝與配置 RedisCentOSRedis
- CentOS 7 yum安裝與配置 TomcatCentOSTomcat
- CentOS安裝配置yumCentOS
- linux配置本地yum安裝--FTP yumLinuxFTP
- postgresql的yum安裝及配置方法SQL
- CentOS配置Nginx官方的Yum源及yum安裝phpCentOSNginxPHP
- CentOS7下MySQL5.7安裝與配置(YUM)CentOSMySql
- Linux下安裝java及配置(yum安裝)LinuxJava
- yum安裝與原始碼安裝比較原始碼
- 配置本地yum源及安裝必要的包
- 詳解 RHEL7.1 yum源配置與軟體安裝
- Zabbix 簡介與yum安裝
- CentOs下 SVN版本控制的安裝(包括yum與非yum)CentOS
- yum安裝jdk如何配置JAVA_HOMEJDKJava
- yum方式安裝及配置最新的mysql5.7MySql
- CentOS7 64位下MySQL5.7安裝與配置(YUM)CentOSMySql
- yum安裝
- AIX的yum安裝AI
- (轉)CentOS 下 rpm包與 yum 安裝與解除安裝CentOS
- mysql安裝 (yum 安裝)MySql
- 本地windows搭建spark環境,安裝與詳細配置(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)WindowsSparkJDKHadoop
- redhat配置yum環境安裝rpm包Redhat
- 12C安裝及本地YUM源配置
- centos7 (阿里雲、linux) 單機spark的安裝與配置詳解(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)CentOS阿里LinuxSparkJDKHadoop
- yum 安裝 PHPPHP
- mysql yum 安裝MySql
- yum安裝nginxNginx
- yum安裝lampLAMP
- yum安裝mysqlMySql
- YUM安裝最新的MYSQLMySql
- Hive的安裝與配置Hive
- PG的安裝與配置
- Redis的安裝與配置Redis
- Vue的安裝與配置Vue
- Linux 使用Yum安裝Go和配置環境LinuxGo
- linux 安裝yum 安裝phpLinuxPHP
- Centos 安裝yum,安裝ansibleCentOS