默认情况下redhat的yum源是收费的,我们可以使用centos的源
cd /etc/yum.repos.d
vi rhel-debuginfo.repo将内容修改为
[base]
name=CentOS-5 - Base
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[update]
name=CentOS-5 - Updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[addons]
name=CentOS-5 - Addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[extras]
name=CentOS-5 - Extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[centosplus]
name=CentOS-5 - Plus
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
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=1
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
然后在此文件夹下面新建rpmforge.repo,mirrors-rpmforge两个文件
vi rpmforge.repo设置内容为
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el5/en/$basearch/dag
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
vi mirrors-rpmforge设置内容为
http://apt.sw.be/redhat/el5/en/$ARCH/dag
http://archive.cs.uu.nl/mirror/dag.wieers/redhat/el5/en/$ARCH/dag
http://ftp2.lcpe.uni-sofia.bg/freshrpms/pub/dag/redhat/el5/en/$ARCH/dag
#http://ftp.heanet.ie/pub/freshrpms/pub/dag/redhat/el5/en/$ARCH/dag
http://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/$ARCH/dag
http://mirror.cpsc.ucalgary.ca/mirror/dag/redhat/el5/en/$ARCH/dag
http://mirrors.ircam.fr/pub/dag/redhat/el5/en/$ARCH/dag
http://rh-mirror.linux.iastate.edu/pub/dag/redhat/el5/en/$ARCH/dag
http://rpmfind.net/linux/dag/redhat/el5/en/$ARCH/dag
http://wftp.tu-chemnitz.de/pub/linux/dag/redhat/el5/en/$ARCH/dag
http://www.mirrorservice.org/sites/apt.sw.be/redhat/el5/en/$ARCH/dag
在此之后需要安装一个软件包rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-* //输入KEY
如果key不匹配则手动指定
rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
为yum加速安装这个软件包yum-fastestmirror
OK了之后就可以用yum来安装软件了,再也不用担心依赖问题了
出现错误:
Error: yum conflicts with yum-rhn-plugin < 0.5.3-30.el5
解决:yum remove yum-rhn-plugin
然后yum update
如果电脑碰巧不能联网,没关系,我们还可以拿DVD镜像制作本地yum源
首先挂在上光盘,把光盘上的东西拷贝出来,这里我复制到/tmp/packges目录下
vi /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp:///tmp/packges/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///tmp/packges/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=file:///tmp/packges/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=file:///tmp/packges/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
然后安装一下软件包 rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm 重新生成依赖关系
# createrepo -o /tmp/packges/Cluster -g /tmp/packges/Cluster/repodata/comps-rhel5-cluster.xml
# createrepo -o /tmp/packges/ClusterStorage -g /tmp/packges/ClusterStorage/repodata/comps-rhel5-cluster-st.xml
# createrepo -o /tmp/packges/Server -g /tmp/packges/Server/repodata/comps-rhel5-server-core.xml
# createrepo -o /tmp/packges/VT -g /tmp/packges/VT/repodata/comps-rhel5-vt.xml
之后修改/usr/lib/python2.4/site-packages/yum/yumRepo.py第411行:
remote = url + '/' + relative
改为:
remote = “/tmp/packges” + '/' + relative
yum clean all;yum install
之后就可以了,执行yum install vsftp试一下!如果还嫌麻烦,那这样,直接拿上光盘挂载,用光盘做yum源!