安裝環(huán)境:VPS,CentOS 6 + devel包
一、安裝相應(yīng)的軟件
1.安裝python
下載Python源碼包
[root@akinlau ~]# wget http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tar.bz2
解壓Python源碼包
[root@akinlau ~]# tar jxvf Python-2.4.3.tar.bz2
編譯安裝Python
[root@akinlau ~]# cd Python-2.4.3
[root@akinlau Python-2.4.3]# ./configure
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking for --without-gcc... no
checking for --with-cxx=<compiler>... no
checking for c++... c++
checking for /dev/ptmx... yes
checking for /dev/ptc... no
checking for socklen_t... yes
checking for build directories... done
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Modules/Setup.config
config.status: creating pyconfig.h
creating Setup
creating Setup.local
creating Makefile
[root@akinlau Python-2.4.3]# make
[root@akinlau Python-2.4.3]# make install
running install_scripts
copying build/scripts-2.4/smtpd.py -> /usr/local/bin
copying build/scripts-2.4/pydoc -> /usr/local/bin
copying build/scripts-2.4/idle -> /usr/local/bin
changing mode of /usr/local/bin/smtpd.py to 755
changing mode of /usr/local/bin/pydoc to 755
changing mode of /usr/local/bin/idle to 755
if test -f /usr/local/bin/python -o -h /usr/local/bin/python;
then rm -f /usr/local/bin/python;
else true;
fi
(cd /usr/local/bin; ln python2.4 python)
Creating directory /usr/local/man
Creating directory /usr/local/man/man1
/usr/bin/install -c -m 644 ./Misc/python.man
/usr/local/man/man1/python.1
2.下載并安裝python-urlgrabber,python-pycurl,yum-metadata-parser
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-8.el6.noarch.rpm
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-8.el6.x86_64.rpm
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@akinlau ~] rpm -ivh python-urlgrabber-3.9.1-8.el6.noarch.rpm python-pycurl-7.19.0-8.el6.x86_64.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
3.創(chuàng)建yum配置文件
[root@akinlau ~] touch /etc/yum.conf
4.下載yum源碼包并安裝
[root@akinlau ~] wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
解壓源碼包
[root@akinlau ~] tar zxvf yum-3.4.3.tar.gz
編譯安裝yum
[root@akinlau ~] cd yum-3.4.3
[root@akinlau yum-3.4.3] ./yummain.py install yum
base | 3.7 kB 00:00
base/primary_db | 4.5 MB 00:07
extras | 3.5 kB 00:00
extras/primary_db | 23 kB 00:03
出現(xiàn)以上提示就證明yum已經(jīng)安裝成功了。
二、配置yum源(建議使用國內(nèi)的163和sohu源,速度比較快)
1.網(wǎng)易(163) yum源
下載對(duì)應(yīng)版本repo文件, 放入/etc/yum.repos.d/(操作前請(qǐng)做好相應(yīng)備份)
CentOS5
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
CentOS6
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
運(yùn)行yum makecache生成緩存
2.搜狐(sohu) yum 源
下載CentOS-Base-sohu.repo, 放入/etc/yum.repos.d/
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
運(yùn)行yum makecache生成緩存
3.EPEL源
下載相應(yīng)的RPM包安裝
第6版企業(yè)版 Linux
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
第5版企業(yè)版 Linux
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
4.RPMForge源
下載對(duì)應(yīng)系統(tǒng)版本的RPM包安裝
EL 6:
i686:
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
x86_64:
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
EL 5:
i386:
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
x86_64:
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
163和sohu的源直接下載相應(yīng)的repo文件放到/etc/yum.repos.d/目錄,然后運(yùn)行yum makecache生成緩存就可以使用
EPEL源和RPMForge源(國外的yum源)都是下載相應(yīng)的RPM包安裝后會(huì)自動(dòng)在/etc/yum.repos.d/目錄下生成相應(yīng)的repo文件,然后運(yùn)行yum makecache生成緩存就可以使用
不建議多種源一起用,一般情況下一個(gè)官方標(biāo)準(zhǔn)源加一個(gè)上面的其中一個(gè)源就足夠用了,以上源對(duì)CentOS等系統(tǒng)完全兼容,但各軟件庫之間并不能保證完全兼容沒有沖突。如果您需要同時(shí)使用以上源,您需要安裝yum-priorities插件。安裝yum-priorities插件后,您可以給各個(gè)源設(shè)置優(yōu)先級(jí)priority。一般設(shè)置官方標(biāo)準(zhǔn)源優(yōu)先級(jí)為1,最高,第三方源推薦>10(priority=N (N為1到99的正整數(shù),數(shù)值越小越優(yōu)先)。如果不想使用某個(gè)源的話可以在repo文件中設(shè)置 enabled=0不啟用該源,如果想啟用設(shè)成enabled=1就可以了。
下面以官方標(biāo)準(zhǔn)源:CentOS-Base.repo為例子,說明一下主要的設(shè)置選項(xiàng):
[base] //軟件源的名稱,將被yum取得并識(shí)別
name=CentOS-$releasever - Base //定義軟件倉庫的名稱,沒實(shí)際作用
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
//mirrorlist指定鏡像服務(wù)器的地址列表
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
//baseurl指定一個(gè)源的鏡像服務(wù)器地址,這里加了#表示注釋了yum將忽略這一行
priority=1 //設(shè)置源優(yōu)先級(jí),1到99的正整數(shù),數(shù)值越小越優(yōu)先
enabled=0 //這個(gè)選項(xiàng)表示是否啟用repo中定義的這個(gè)源,0為禁用,1為啟用
gpgcheck=1 //這個(gè)選項(xiàng)表示是否要對(duì)下載的rpm包進(jìn)行gpg的校驗(yàn),來確定rpm包的來源是有效和安全的,跟下面的gpgkey成對(duì)使用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 //定義用于校驗(yàn)的gpg密鑰
關(guān)鍵字:VPS,YUM安裝,YUM源配置