CentOS(二)[yum]

系统:CentOS-7最小化安装

1.yum源配置

yum源配置参考
阿里巴巴开源镜像站
CentOS镜像配置参考

1.备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. 运行 yum makecache 生成缓存

yum makechache

4.yum源更新

yum update -y

2.语法

yum [options] [command] [package ...]

1.options

选项说明
-h, --help显示此帮助消息并退出
-t, --tolerant忽略错误
-C, --cacheonly完全从系统缓存运行,不升级缓存
-c [config file], --config=[config file]配置文件路径
-R [minutes], --randomwait=[minutes]命令最长等待时间
-d [debug level], --debuglevel=[debug level]调试输出级别
–showduplicates在 list/search 命令下,显示源里重复的条目
-e [error level], --errorlevel=[error level]错误输出级别
–rpmverbosity=[debug level name]RPM 调试输出级别
-q, --quiet静默执行
-v, --verbose详尽的操作过程
-y, --assumeyes回答全部问题为是
–assumeno回答全部问题为否
–version显示 Yum 版本然后退出
–installroot=[path]设置安装根目录
–enablerepo=[repo]启用一个或多个软件源(支持通配符)
–disablerepo=[repo]禁用一个或多个软件源(支持通配符)
-x [package], --exclude=[package]采用全名或通配符排除软件包
–disableexcludes=[repo]禁止从主配置,从源或者从任何位置排除
–disableincludes=[repo]disable includepkgs for a repo or for everything
–obsoletes更新时处理软件包取代关系
–noplugins禁用 Yum 插件
–nogpgcheck禁用 GPG 签名检查
–disableplugin=[plugin]禁用指定名称的插件
–enableplugin=[plugin]启用指定名称的插件
–skip-broken忽略存在依赖关系问题的软件包
–color=COLOR配置是否使用颜色
–releasever=RELEASEVER在 yum 配置和 repo 文件里设置 $releasever 的值
–downloadonly仅下载而不更新
–downloaddir=DLDIR指定一个其他文件夹用于保存软件包
–setopt=SETOPTS设置任意配置和源选项
–bugfixInclude bugfix relevant packages, in updates
–securityInclude security relevant packages, in updates
–advisory=ADVS, --advisories=ADVSInclude packages needed to fix the given advisory, in updates
–bzs=BZSInclude packages needed to fix the given BZ, in updates
–cves=CVESInclude packages needed to fix the given CVE, in updates
–sec-severity=SEVS, --secseverity=SEVSInclude security relevant packages matching the severity, in updates

2.command

命令说明
check检查 RPM 数据库问题
check-update检查是否有可用的软件包更新
clean删除缓存数据
deplist列出软件包的依赖关系
distribution-synchronization已同步软件包到最新可用版本
downgrade降级软件包
erase从系统中移除一个或多个软件包
fsActs on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.
fssnapshotCreates filesystem snapshots, or lists/deletes current snapshots.
groups显示或使用、组信息
help显示用法提示
history显示或使用事务历史
info显示关于软件包或组的详细信息
install向系统中安装一个或多个软件包
list列出一个或一组软件包
load-transaction从文件名中加载一个已存事务
makecache创建元数据缓存
provides查找提供指定内容的软件包
reinstall覆盖安装软件包
repo-pkgs将一个源当作一个软件包组,这样我们就可以一次性安装/移除全部软件包。
repolist显示已配置的源
search在软件包详细信息中搜索指定字符串
shell运行交互式的 yum shell
swapSimple way to swap packages, instead of using shell
update更新系统中的一个或多个软件包
update-minimalWorks like upgrade, but goes to the ‘newest’ package match which fixes a problem that affects your system
updateinfoActs on repository update information
upgrade更新软件包同时考虑软件包取代关系
version显示机器和/或可用的源版本。

3.常用

1.所有可更新的软件

yum check-update

在这里插入图片描述

2.更新所有软件

yum -y update  

在这里插入图片描述

3.安装指定的软件

yum -y install <package_name> 

4.更新指定的软件

yum -y update <package_name>

5.所有可安裝的软件

yum list

6.删除软件包

yum -y remove <package_name> 

7.查找软件包

yum search <keyword>

或者

yum search all <keyword>

8.清除缓存

1. 清除缓存目录下的软件包
yum clean packages
2.清除缓存目录下的 headers
yum clean headers:
3.清除缓存目录下旧的 headers
yum clean oldheaders
4.清除缓存目录下的软件包及旧的headers

(等价于 yum clean packages; yum clean oldheaders)

yum clean all 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值