共计 2816 个字符,预计需要花费 8 分钟才能阅读完成。
回复【1001】获取 linux 常用命令速查手册
yum 命令 是在 Fedora 和 RedHat 以及 SUSE 中基于 rpm 的软件包管理器,它能够使系统管理人员交互和自动化地更新与治理 RPM 软件包,可能从指定的服务器主动下载 RPM 包并且装置,能够主动解决依赖性关系,并且一次装置所有依赖的软体包,毋庸繁琐地一次次下载、装置。
yum 提供了查找、装置、删除某一个、一组甚至全副软件包的命令,而且命令简洁而又好记。
命令格局
yum(选项)(参数)
命令选项
- -h:显示帮忙信息;
- -y:对所有的发问都答复“yes”;
- -c:指定配置文件;
- -q:宁静模式;
- -v:具体模式;
- -d:设置调试等级(0-10);
- -e:设置谬误等级(0-10);
- -R:设置 yum 解决一个命令的最大等待时间;
- -C:齐全从缓存中运行,而不去下载或者更新任何头文件
命令参数
- install:装置 rpm 软件包;
- update:更新 rpm 软件包;
- check-update:查看是否有可用的更新 rpm 软件包;
- remove:删除指定的 rpm 软件包;
- list:显示软件包的信息;
- search:查看软件包的信息;
- info:显示指定的 rpm 软件包的形容信息和概要信息;
- clean:清理 yum 过期的缓存;
- shell:进入 yum 的 shell 提示符;
- resolvedep:显示 rpm 软件包的依赖关系;
- localinstall:装置本地的 rpm 软件包;
- localupdate:显示本地 rpm 软件包进行更新;
- deplist:显示 rpm 软件包的所有依赖关系。
主动搜寻最快镜像插件
> yum install yum-fastestmirror
查看可能批量装置的列表
> yum grouplist | |
Available Environment Groups: | |
Minimal Install | |
Compute Node | |
Infrastructure Server | |
File and Print Server | |
Cinnamon Desktop | |
MATE Desktop | |
Basic Web Server | |
Virtualization Host | |
Server with GUI | |
GNOME Desktop | |
KDE Plasma Workspaces | |
Development and Creative Workstation | |
Available Groups: | |
Cinnamon | |
Compatibility Libraries | |
Console Internet Tools | |
Development Tools | |
Educational Software | |
Electronic Lab | |
Fedora Packager | |
General Purpose Desktop | |
Graphical Administration Tools | |
Haskell | |
LXQt Desktop | |
Legacy UNIX Compatibility | |
MATE | |
Milkymist | |
Scientific Support | |
Security Tools | |
Smart Card Support | |
System Administration Tools | |
System Management | |
TurboGears application framework | |
Xfce | |
Done |
比方:
yum groupinstall "Basic Web Server"
装置 redis
> yum install redis -y
更新零碎中所有的 RPM
包
> yum update
更新指定的软件包(如:redis)
> yum update redis
查看可更新的程序
> yum check-update
查看零碎中是否装置某个软件(如:nginx)
> yum list installed | grep nginx
显示安装包信息
> yum info nginx | |
Installed Packages | |
Name : nginx | |
Arch : x86_64 | |
Epoch : 1 | |
Version : 1.16.1 | |
Release : 1.el7.ngx | |
Size : 2.7 M | |
Repo : installed | |
From repo : nginx | |
Summary : High performance web server | |
URL : http://nginx.org/ | |
License : 2-clause BSD-like license | |
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as | |
: a mail proxy server. | |
Available Packages | |
Name : nginx | |
Arch : x86_64 | |
Epoch : 1 | |
Version : 1.18.0 | |
Release : 2.el7.ngx | |
Size : 769 k | |
Repo : nginx/x86_64 | |
Summary : High performance web server | |
URL : http://nginx.org/ | |
License : 2-clause BSD-like license | |
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as | |
: a mail proxy server. |
显示所有曾经装置和能够装置的程序包
> yum list
显示指定程序包装置状况
> yum list nginx
删除程序包
> yum remove nginx
查看软件包的依赖状况
> yum deplist nginx
革除缓存目录下的软件包
> yum clean packages
革除缓存目录下的 headers
> yum clean headers
革除缓存目录下旧的 headers
> yum clean oldheaders
分明缓存目录下的所有软件包及旧的 headers
> yum clean all
强制解除 yum 锁定
> rm -rf /var/run/yum.pid
yum 减速更新国内源
> cd /etc/yum.repos.d | |
> mv CentOS-Base.repo CentOS-Base.repo.bk | |
// 更新为阿里云的源 | |
> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo | |
// 更新为 163 的源 | |
> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo | |
// 更新为搜狐的源 | |
> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.sohu.com/help/CentOS-Base-sohu.repo | |
> yum clean all | |
> yum makecache |
原文链接:https://rumenz.com/rumenbiji/…
微信公众号: 入门小站
- 回复【1001】获取 linux 常用命令速查手册
- 回复【10010】获取 阿里云 ECS 运维 Linux 系统诊断
- 回复【10012】获取 Linux 学习笔记【强悍总结值得一看】
- 回复【10013】获取 shell 扼要教程
正文完