redhat5yum源配置

1备份原数据
 mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
 mv /etc/yum.repos.d/rpmforge.repo.rpmnew /etc/yum.repos.d/rpmforge.repo.rpmnew.bak


2建立新的配置文件
[root@killgoogle ~]#vi 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 but not 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 extend functionality 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
修改第二个配置文件: 
[root@killgoogle ~]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
修改第三个配置文件: 
[root@killgoogle ~]# vi rpmforge.repo 
# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag 
# URL: http://rpmforge.net/
[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 




3 设置超时时间
vi /etc/yum.conf 
加上这么一句:timeout=120 




4 安装包rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm 


5 rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


6 yum update


7安装软件测试
yum install mplayer 


yum remove mplayer








========================================================
yum缓存目录
/var/cache/yum/base/packages目录下












使用yum只下载不安装
1. 安装yum-downloadonly或 yum-plugin-downloadonly 软件包。


可以执行以下命令安装yum-downloadonly包:


#yum install yum-downloadonly


说明:yum-downloadonly是yum的一个插件,使得yum可以从RHN或者yum的仓库只下载包而不安装。


安装完成后,查看/etc/yum/pluginconf.d/downloadonly.conf 配置文件的内容,确认这个插件已经启用:


[main] 
enabled=1


2. 举例,从yum源下载***软件包


# yum install --downloadonly ***


默认下载保存的位置是 /var/cache/yum/{RepositoryName}/packages/目录。可以使用yum的参数--downloaddir来指定自定义的路径。与 --downloadonly 参数一块使用。


# yum install --downloadonly --downloaddir=/download ***













你可能感兴趣的:(redhat5yum源配置)