yum 本地源的配置
[root@jesse ~]# cd /etc/yum.repos.d/
[root@jesse yum.repos.d]# ls
CentOS-Base.repo CentOS-Media.repo
[root@jesse yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.BAK
[root@jesse yum.repos.d]# ls
CentOS-Base.repo.BAK CentOS-Media.repo
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@jesse yum.repos.d]# vi 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:///mnt/
gpgcheck=0
enabled=1
#wq 保存并退出
#/mount /dev/cdrom mnt
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
网络源的配置详解:
[root@jesse ~]# cd /etc/yum.repos.d/
[root@jesse yum.repos.d]# ls
CentOS-Base.repo CentOS-Media.repo
[root@jesse yum.repos.d]# vi CentOS-Base.repo
#以下是我修改好的网络源
#改动地点:1注释掉了mirrorlist开头得行,打开baseurl开头的行2:将mirror.centos.org修改成了mirrors.sohu.com
#批量替换方法:vi 命令模式下输入%s/mirror.centos.org/mirrors.sohu.com/g
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5