Linux之yum命令

yum命令 是在Fedora和RedHat以及SUSE中基于rpm的软件包管理器,它可以使系统管理人员交互和自动化地更新与管理RPM软件包,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。

yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。

命令格式

yum(选项)(参数)

命令选项

命令参数

自动搜索最快镜像插件

> 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
展开阅读全文

页面更新:2024-04-23

标签:命令   提示符   阿里   管理人员   软件包   缓存   选项   等级   参数   模式   情况   关系   程序包   系统   科技   信息

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top