CentOS软件管理工具yum使用
1.简介
Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
2.通过包名搜索
yum search tcpdump
3.搜索具备指定可执行命令的包
yum provides tree
# 或
yum provides "*/tree"
# 搜索结果如下:
psmisc-22.20-16.el7.x86_64 : Utilities for managing processes on your system
源 :base
匹配来源:
文件名 :/usr/bin/pstree
yum install -y psmisc-22.20-16.el7.x86_64
# 查询包含指定so库
yum provides nouveau_dri.so
4.查看包依赖关系
yum deplist net-tools
5.下载指定包及其依赖包并进行离线安装
yum install yum-utils
yumdownloader --resolve --destdir /tmp/net-tools net-tools
cd /tmp/net-tools
rpm -ivh ./*
更多命令使用man命令查看手册
man yum
6./etc/yum.conf
通过
man yum.conf
查看手册
yum配置文件
[main]
# 缓存路径
cachedir=/var/cache/yum/$basearch/$releasever
# 0-不保留 1-保留,可通过yum clean all (相当于yum clean headers+yum clean packages);可结合packages时间使用
keepcache=0
# 0-10
debuglevel=2
logfile=/var/log/yum.log
#CPU架构精准匹配 0-否 1-是
exactarch=1
# 提供过期安装包
obsoletes=1
# gpg 签名验证
gpgcheck=1
# 插件开关
plugins=1
# 同时安装包的数量限制
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
# 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
参考:
centos下查看软件依赖关系