您的位置:首页 > 其它

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

2016-05-28 16:37 375 查看
yum 安装软件远比 rpm 使用方便,下面简单描述下 rhel 6.x 的yum 配置 

# cd /mnt

# mkdir cdrom

# mount /dev/cdrom /mnt/cdrom

# cat /etc/yum.conf 

[main]

cachedir=/var/cache/yum/$
4000
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: