Java在linux系統的部署(2): 系統環境的安裝——更換免費的Yum源(轉載)

NO IMAGE

更換redhat免費源的方式從網上找了一個,效果還不錯,原網址:http://blog.chinaunix.net/uid-24727220-id-176948.html

由於,redhat企業版yum為收費專案,所以更換免費的源,這樣在架設伺服器的時候缺少某些元件可以用yum來進行新增,方便快捷,其實yum的速度沒有太慢的,下面我將為大家介紹如何快速的修改yum源。

一、刪除原yum所有元件

rpm -qa | grep yum | xargs rpm -e –nodeps #這條程式碼將刪除redhat自帶的yum

二、下載yum元件 yum.rar    

rpm包已經有了,自己下載解壓

[[email protected] yum]# ll

total 1108

-rw-r–r– 1 root root 34394 Feb 2509:46 python-iniparse-0.2.3-4.el5.noarch.rpm

-rw-r–r– 1 root root 1026405 Feb 2509:45 yum-3.2.22-26.el5.centos.noarch.rpm

-rw-r–r– 1 root root 19145 Feb 2509:46 yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

-rw-r–r– 1 root root 26053 Feb 2509:41 yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

三、下面將要安裝著四個軟體包,切記按照我的安裝順序來,否則會出現報錯,切記~

 cd /tools/yum

rpm -ivhpython-iniparse-0.2.3-4.el5.noarch.rpm

rpm -ivhyum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

rpm -ivhyum-3.2.22-26.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

四、下面下載yum的配置檔案CentOS-Base.rar   

上面的包是為redhat5.4準備的,如果你用不了的話,就把下面的程式碼寫到CentOS-Base.repo中儲存在/etc/yum.repos.d/

#CentOS-Base.repo

# # Thisfile uses a new mirrorlist system developed by Lance Davis for CentOS.

# Themirror system uses the connecting IP address of the client and the

# updatestatus of each mirror to pick mirrors that are updated to and

#geographically close to the client. You should use this for CentOS updates

# unlessyou are manually picking other mirrors.

#

# If themirrorlist= does not work for you, as a fall back you can try the

# remarkedout baseurl= line instead.

#

# [base]

name=CentOS-$releasever- Base

baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#releasedupdates

[updates]

name=CentOS-$releasever- Updates

baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/

gpgcheck=1

gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#packagesused/produced in the build but not released

[addons]

name=CentOS-$releasever- Addons

baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/

gpgcheck=1

gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additionalpackages that may be useful

[extras]

name=CentOS-$releasever- Extras

baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/

gpgcheck=1

gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additionalpackages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever- Plus

baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/

gpgcheck=1enabled=0

gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

 把這個檔案放在   /etc/yum.repos.d/

 大功告成,yum已經更新為不用花錢的啦  

注:如何覺著下載這麼多不方便,可以下下載 yum.rar  這個包,放在/tools/下面 
然後執行“sh/tools/yum/yum_stat.sh”  即可