Home

zhangyiqun

Thoughts, stories and ideas.

Notes Blog Archives About
06 Aug 2009

yum加速一条龙

[root@filerserver python]#cd /etc/yum.repos.d

[root@filerserver python]#mv CentOS-Base.repo CentOS-Base.repo.save

[root@filerserver python]#wget http://centos.ustc.edu.cn/CentOS-Base.repo.5

[root@filerserver python]#mv CentOS-Base.repo.5 CentOS-Base.repo

dba blog看到的

懒人可以直接下载这个脚本执行以下,执行脚本需要root权限

#wget  http://www.zhangyiqun.cn/wp-content/uploads/2009/08/fastyum

当然如果是实验环境还可以选择使用本地光盘作为yum源

把光盘加载到本地

[root@localhost CentOS]# mount /dev/cdrom /media

在/etc/yum.repos.d/目录下,有两个文件

CentOS-Base.repo和CentOS-Media.repo

其中CentOS-Base.repo记录着网络上的yum源的地址和路径信息等

CentOS-Media.repo记录着可以从本地作为yum源的介质和路径。其中还有这样一个说明:

# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum –enablerepo=c5-media [command]
#
# or for ONLY the media repo, do this:
#
# yum –disablerepo=\* –enablerepo=c5-media [command]

[c5-media]

name=CentOS-$releasever – Media

baseurl=file:///media/CentOS/

file:///media/cdrom/

file:///media/cdrecorder/

file:///media/    #增加这句

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta

比如安装apache

[root@centos cdrom]# yum disablerepo=* enablerepo=c5media install httpd

Notes Blog Archives About