yum的配置和使用
来源:互联网 发布:dvd电子相册制作软件 编辑:程序博客网 时间:2024/06/18 09:26
yum
yum全称为Yellow dog Updater, Modified,是RPM包的前端管理工具,它的出现解决了RPM包安装时依赖性关系的问题,一次性安装所需要的依赖包,大大方便了软件安装。
yum repository
yum仓库,存储了众多rpm包,以及包的相关的元数据文件(放置于特定目录下:repodata)。可以通俗点理解为软件管家,但不是很准确,yum仓库既可以指定互联网的某台服务器上,也可以本地创建。
以下提供的是国内常见的软件的安装源镜像站:
http://mirrors.aliyun.com/
http://mirrors.163.com/
http://mirrors.sohu.com/
yum配置文件:
/etc/yum.conf:为所有仓库提供公共配置,默认一般不不需要改动
/etc/yum.repos.d/*.repo:为仓库的指向提供配置
我使用的是CentOS6.5,这里我们来看看默认的配置都有哪些:
yum.conf
[main]cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=0debuglevel=2logfile=/var/log/yum.logexactarch=1obsoletes=1gpgcheck=1plugins=1installonly_limit=5bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yumdistroverpkg=centos-release
[main]
cachedir:yum的缓存目录,用于存储下载的rpm包等相关数据
keepcache:是否保存缓存,0为不保存,1为保存
debuglevel:错误级别,用于日志记录
logfile:yum日志文件存储位置
exactarch:是否精确匹配软件包的平台,1为精确匹配,0为不开启(则允许将x86软件包安装x86_64系统中)
obsoletes:是否允许更新陈旧的软件包,1为允许,0为不允许
gpgcheck:是否检测GPG(数字签名),1为检查,0为不检测
plugins:是否允许使用插件,1为允许,0为不允许
installonly_limit:同时安装多少程序包
bugtracker_url:bug追踪路径
distroverpkg:将变量$releasever设置为centos-release这个rpm包的版本号
CentOS-Base.repo
# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-$releasever - Updatesmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[base]:仓库名称
name:仓库简介
baseurl:获取软件包的路径
gpgcheck:是否检测GPG(数字签名),1为检查,0为不检测
enabled:是否启用此仓库,1为启用,0为关闭
gpgkey:GPG(数字签名)的key文件所在路径
Tip:
几个变量需要注意下:
$releasever: 当前OS的发行版的主版本号;
$arch: 平台;
$basearch:基础平台;
$YUM0-$YUM9
详情可以参考man 5 yum.conf
yum的使用
使用网络上的yum源:
使用光盘作本地yum仓库:
(2) 创建配置文件
# CentOS-Media.repo## This repo can be used with mounted DVD media, verify the mount point for# CentOS-6. 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=c6-media [command]# # or for ONLY the media repo, do this:## yum --disablerepo=\* --enablerepo=c6-media [command][c6-media]name=CentOS-$releasever - Mediabaseurl=file:///media/cdrom/gpgcheck=1enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
yum常用命令
- yum的配置和使用
- yum配置和使用
- redhat7 yum的配置和使用
- YUM的配置与使用
- apt和yum的使用
- rpm和yum的使用
- RHEL5 使用 CentOS5 的 YUM及配置YUM仓库
- yum源配置以及yum的使用解析示例
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- 配置RHEL6使用CentOS的yum源
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- CentOS yum 源的配置与使用
- 【转】使用gdb和core dump迅速定位段错误
- 1011. World Cup Betting (20)
- C语言解决大数的阶层问题
- 第一行代码-3.7 编写界面的最佳实践
- 数据结构--动态规划
- yum的配置和使用
- 来用Qt实现一个桌面弹幕程序吧
- 关于对象的构造、复制构造、析构、赋值的问题
- 验证用户登录(perl)
- HDU 1010 深度搜索问题
- HDOJ-2032
- 注册新用户(perl)
- nyoj477 A+B=C
- MySQL知识(二)——数据表的基本操作