Redhalt配置Centos的yum源 詳細步驟

來源:互聯網
上載者:User

標籤:redhalt配置centos的yum源 詳細步驟

  大家都應該都清楚,redhalt 剛裝完系統之後的yum是不好使的,有時我們像安裝vsftp 這樣的軟體時用yum安裝很方便。為此我們需要利用centos的yum源進行配置。現在這個源更新速度很快。 這是網易的資源總庫http://mirror.centos.org/。裡面應有盡有。廢話不多說:

具體安裝步驟:

1、刪除redhat原有的yum源

# rpm -aq | grep yum|xargs rpm -e –nodeps


2、重新從網上擷取yum的安裝包 

以root登陸到redhalt系統,預設目錄已經切換到 /root,通過wget命令下載相應的yum包。

具體命令如下:

#wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm


#wget  http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm


#wget  http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm


#wget  http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

這樣四個需要安裝的包全部就下載下來了,接下來就是需要安裝了。

3.安裝軟體包

# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

注意:後面兩個需要一起安裝才行。因為具有軟體依賴關係。當時我安裝最後兩個包時出現了一個錯誤,如下:

[r[email protected] ~]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

warning:yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key IDc105b9de: NOKEY

error: Failed dependencies:

       python-urlgrabber >= 3.9.1-10 is needed byyum-3.2.29-73.el6.centos.noarch

還是軟體依賴的問題,需要安裝大於3.9.1-10版本的python-urlgrabber

於是又去下了一個大於3.9.1-10版本的python-urlgrabber的rpm包。

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/ python-urlgrabber-3.9.1-11.el6.noarch.rpm 

繼續先安裝python-urlgrabber-3.9.1-11.el6.noarch.rpm 包;


# rpm -ivh  python-urlgrabber-3.9.1-11.el6.noarch.rpm

安裝完成後繼續重複剛才最後一個步驟:

# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

終於好使了。


4、更改yum源,使用網易的鏡像站。

切換目錄到 /etc/yum.repos.d/目錄下

# cd /etc/yum.repos.d/

# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo  

# vim  CentOS6-Base-163.repo  

編輯CentOS6-Base-163.repo 檔案,把檔案裡面的$releasever全部替換為版本號碼,這個地方是版本6 ,最後儲存退出。如下:

# CentOS-Base.repo

#

# 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-6 - Base - 163.com   

baseurl=http://mirrors.163.com/centos/6/os/$basearch/----這裡一定要是網易庫的路徑名

#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#released updates

[updates]

name=CentOS-6 - Updates - 163.com

baseurl=http://mirrors.163.com/centos/6/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additional packages that may be useful

[extras]

name=CentOS-6 - Extras - 163.com

baseurl=http://mirrors.163.com/centos/6/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-6 - Plus - 163.com

baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-6 - Contrib - 163.com

baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

改完之後退出編輯儲存退出

5.測試是否安裝好 

# yum clean all            #清理yum緩衝 

#yum makecache        #將伺服器上的軟體包資訊緩衝到本地,以提高搜尋安裝軟體的速度。

你會看到緩衝過程,說明已經安裝好了。

# yum list yum    #測試組態的yum源是否已經生效。

下面就可以用yum安裝一系列軟體了。



本文出自 “Linux營運” 部落格,請務必保留此出處http://dragon007.blog.51cto.com/7740555/1881191

Redhalt配置Centos的yum源 詳細步驟

聯繫我們

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