之前一直用的是ubuntu的系统,安装软件只要使用apt-get install **就可以很方便的安装好软件,特别是交大也有源,速度非常的快。
这些天装了redhat,发现apt-get install无法使用了,每次安装软件都要先下载源代码的包,解压后./configure--》make--》make install这个步骤才行。或者是rpm –ivh *.rpm。后来知道上面也有类似与ubuntu的apt-install,叫做yum。但是,实际却发现无法使用,好像是因为yum是个收费的软件,除非你用的是收费版的redhat,否则都是要花钱用的,后来通过使用Centos5的yum解决了这个问题。
Yum的下载地址http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/,我们需要的有rpmyum-3.2.22-33.el5.centos.noarch.rpm,yum-downloadonly-1.1.16-14.el5.centos.1.noarch.rpm,yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm,yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm,yum-utils-1.1.16-14.el5.centos.1.noarch.rpm这5个rpm,找到先下载到本地,然后
rpm –ivh yum*
安装这5个包。如果之前有安装yum,需要卸载(首先先用rpm -qa|grep yum*指令来查看原先的yum安装文件,直接rpm -e 来删除具体的已安装的yum文件,若遇到依赖问题,直接--nodeps)
之后修改YUM的源,编辑/etc/yum.repos.d/rhel-debuginfo.repo文件,里面内容全部替换为
[base]
name=CentOS-5 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=CentOS-5 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build butnot released
[addons]
name=CentOS-5 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that extendfunctionality of existing packages
[centosplus]
name=CentOS-5 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# vi dag.repo
[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
然后导入key
rpm --import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
OK,现在可以用yum来install软件了,比如安装gcc编译环境。。。。轻松多了~~~