CentOS安裝第三方套件加強YUM功能

作者: | 2009-11-11
Logo

YUM是個很好用的套件管理員,但是版本不一定會是最新也就不會是最安全,所以利用第三方套件來加強YUM的功能吧! ;)

加速YUM套件升級

YUM預設是運用鏡像站來下載更新,這邊要做的是不尋找鏡像站,而直接指定到哪個鏡像站來下載套件。

編輯CentOS-Base.repo裡面的baseurl位置到CentOS各國的鏡像站,這邊選的是中華電信~

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
vi /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever – Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[update]
name=CentOS-$releasever – Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever – Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever – Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever – Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib – packages by Centos Users
[contrib]
name=CentOS-$releasever – Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/contrib/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

所以只要先註釋掉mirrorlist再把http://mirror01.idc.hinet.net/CentOS/換上其他各國鏡像站的網址來符合你主機的所在位置就會很快! :D

台灣 前三個都超快的~ 挑一個離自己近的用囉! (Y)

中華電信 IDC HTTP FTP
中山大學 HTTP
交通大學 HTTP FTP
樹德科技大學 HTTP FTP
靜宜大學 HTTP FTP
台中縣教育網路中心 HTTP FTP Direct DVD
元智大學 HTTP FTP Direct DVD

老美

Facebook (Palo Alto, CA) HTTP // 沒看錯~ 真的是灰死不可! (H)
ESnet (Berkeley, CA) HTTP FTP RSYNC Direct DVD // 這個一定快 =.= 美國能源局網路! 嚇嚇叫的呢~ :kao
Easynews (Phoenix, AZ) HTTP FTP // 老牌的線上新聞群組…很老很老.. :kao
FDCservers.net LLC (Chicago, IL) HTTP FTP // 主機商
Liquid Web, Inc. (Lansing, MI) HTTP RSYNC // 主機商
InterServer, Inc (Secaucus, NJ) HTTP RSYNC Direct DVD // 主機商
Ray Stedman Library (Houston, TX) HTTP RSYNC Direct DVD

歐洲 荷蘭網路很發達,又是歐洲的資訊業樞紐,選荷蘭其實就OK了~

Association NLUUG (Amsterdam, Netherlands) HTTP FTP RSYNC Direct DVD
LeaseWeb (Amsterdam, Netherlands) HTTP FTP RSYNC Direct DVD
Liteserver.nl (Wageningen, Netherlands) HTTP FTP Direct DVD
Combi Networks (Manchester, United Kingdom) HTTP FTP
UK Mirror Service – Univ. Kent (Manchester, United Kingdom) HTTP FTP RSYNC Direct DVD

官方的Mirrors List還有很多國家的鏡像站~ CentOS full-mirrorlist.csv

RPMforge

先查詢自己的作業系統版本 uname -icat /etc/*-release 再下載對應的套件

i386 版本

rpm -ihv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ihv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

x86_64 版本

rpm -ihv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ihv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

—–

Jason’s Utter Ramblings Repo

新增文件

vi /etc/yum.repos.d/utterramblings.repo

文件內容

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

存檔後執行

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Dag Wieers

新增文件

vi /etc/yum.repos.d/dag.repo

文件內容

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

存檔後執行

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

CentOS.Karan.Org

wget -P /etc/yum.repos.d/ http://centos.karan.org/kbsingh-CentOS-Extras.repo
wget -P /etc/yum.repos.d/ http://centos.karan.org/kbsingh-CentOS-Misc.repo

rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt

Webtatic Repository

wget -P /etc/yum.repos.d/ http://repo.webtatic.com/yum/webtatic.repo
rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy

SIPfoundry sipXecs pbx

wget -P /etc/yum.repos.d/ http://sipxecs.sipfoundry.org/pub/sipXecs/sipxecs-stable-centos.repo

RubyWorks

wget -P /etc/yum.repos.d/ http://rubyworks.rubyforge.org/RubyWorks.repo

Pidgin, the universal chat client

wget -P /etc/yum.repos.d/ http://rpm.pidgin.im/centos/pidgin.repo

kde-redhat.sf.net

wget -P /etc/yum.repos.d/ http://apt.kde-redhat.org/apt/kde-redhat/redhat/kde.repo
rpm --import http://kde-redhat.sourceforge.net/gpg-pubkey-ff6382fa-3e1ab2ca

OK了~ 以後執行yum -y update刷刷刷~ YUM的一大堆套件版本變得更豐富也更新了! (H)

YUM指令介紹

yum update // 更新,加上 -y 就可以不用確認,直接安裝,範例 yum -y update
yum install xxx // 安裝,加上 -y 就可以不用確認,直接安裝,範例 yum install -y unzip
yum remove xxx // 移除,加上 -y 就可以不用確認,直接安裝,範例 yum remove -y unzip
yum clean all // 清除暫存檔案
yum search xxx // 搜尋
yum list // 列出所有檔案
yum info xxx // 查詢檔案訊息

群組安裝功能:

yum grouplist
yum groupinfo // 範例 yum groupinfo “KDE Software Development”
yum groupinstall // 範例 yum groupinstall -y “KDE Software Development”

RPM基本指令介紹

rpm -ivh xxx // 安裝
rpm -e xxx // 移除
rpm -Uvh xxx // 升級
rpm -qa squid // 查看是否有安裝squid
rpm -q[licdR] // 已安裝的套件名稱
rpm -qf // 存在於系統上面的某個檔案
rpm -qc xxx | grep conf // 可以查看設定檔
rpm -qp[licdR] // 未安裝的某個檔案名稱

資料來源:

鳥哥的 Linux 私房菜 >> 第二十三章、軟體安裝: RPM, SRPM 與 YUM 功能
官方維基 >> 安裝 RPMforge

臉書回應

篇回應

2 thoughts on “CentOS安裝第三方套件加強YUM功能

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

(A)  :@  (brb)  (U)  (:cc)  :S  (H)  :-(  :cute  (6)  :-#  :$  :er  8-)  FUCK 
(})  ({)  GY  (L)  :kao  (K)  :cc  :pu  (F)  :(  ^o)  :-*  :O  +o(  |-) 
:)  (*)  :D  *-)  (N)  (Y)  :P  :|  (W)  ;)  XD