close

參考資料:Google搜尋到的已忘了真正出處了,如有大大知道請告知,小弟再補上,如有侵權,也請告知,小弟將移除

要使用 YUM 必須做一些設定。預設在 /etc/yum.conf 裡面就可以做設定,不過 yum.conf 也有提到,若沒有在裡面做任何配置,它就會自動去尋找 /etc/yum.repos.d/ 裡面的 CentOS-Base.repo 這個檔案。因此我們要針對此檔案做一些調校。

[root@linux ~]# cd /etc/yum.repos.d

[root@linux ~]# cp CentOS-Base.repo CentOS-Base.default

[root@linux ~]# vi CentOS-Base.repo

直接打入下面這行,並存檔離開 ( 進入 vi 後按 Esc )

:%s/mirror.centos.org\/centos/ftp.cse.yzu.edu.tw\/pub\/CentOS

:%s/mirror.centos.org\/centos/ftp.cs.pu.edu.tw\/Linux\/CentOS

:%s/mirror.centos.org\/centos/ftp2.tnc.edu.tw\/pub1\/CentOS

 

另外,我們在安裝一些要用到的一些工具時,或許它並不存在於 CentOS yum 的官方資料庫中。所以我們還要另外定義非官方資料庫文件,讓一些實用的工具也能透過 yum 來安裝。

[root@linux ~]# 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

 

匯入非官方資料庫的GPG

[root@linux ~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

 

這樣子就可以了!

arrow
arrow
    文章標籤
    yum centos
    全站熱搜

    天兒啊 發表在 痞客邦 留言(0) 人氣()