yum 本地源及网络源的配置汇总
时间:2015-01-21 17:52 来源:linux.it.net.cn 作者:IT
yum 本地源及网络源的配置汇总
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$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
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.sohu.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#以上是配置好的较快的网络更新源
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
默认情况下:yum 安装好后的rpm包会被自动清除,如果我们想不自动清除的话,
[root@jesse ~]# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
keepcache=1 #将这里的0修改为1
debuglevel=2
#保存退出
#我们安装好后的软件存放的位置:/var/cache/yum/base/packages
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (责任编辑:IT)
yum 本地源及网络源的配置汇总 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$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 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib baseurl=http://mirrors.sohu.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #以上是配置好的较快的网络更新源 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 默认情况下:yum 安装好后的rpm包会被自动清除,如果我们想不自动清除的话, [root@jesse ~]# vi /etc/yum.conf [main] cachedir=/var/cache/yum keepcache=1 #将这里的0修改为1 debuglevel=2 #保存退出 #我们安装好后的软件存放的位置:/var/cache/yum/base/packages -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (责任编辑:IT) |