yum 在 rhel 6.x 下的本地配置

yum 安装软件远比 rpm 使用方便,下面简单描述下 rhel 6.x 的yum 配置 

# cd /mnt
# mkdir cdrom
# mount /dev/cdrom /mnt/cdrom

# cat /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3


#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m


# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


红色背景说明有两个方法配置yum源,第一种是在 /etc/yum.conf 末尾直接添加,

第二种是在 /etc/yum.repos.d/ 目录下创建 .repo 文件。


第一种方法:

# vi /etc/yum.conf

追加如下内容

[base]
name=base yum 
baseurl=file:///mnt/cdrom
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

[updates-released]
name= updates-released yum 
baseurl=file:///mnt/cdrom
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release



第二种方法: 
# cd /etc/yum.repos.d/
# cp rhel-source.repo  rhel-source.repo.bak
# vi rhel-source.repo

[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///etc/cdrom/RPM-GPG-KEY-redhat-release


[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

你可能感兴趣的:(linux)