CentOS软件包管理之YUM

YUM(全称为Yellow dog Updater, Modified)是一个在RHEL系操作系统中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须频繁地一次次下载、安装。

-------------------------------------------------------------------------------
YUM软件包仓库配置:

YUM软件包管理器针对软件包的操作都要依赖yum的仓库来实现。而yum仓库的配置可以编辑yum的配置文件(/etc/yum.conf、/etc/yum.repos.d/*repo)来实现。 一般情况/etc/yum.conf下主要是yum的主配置文件,/etc/yum.repos.d/*.repo主要是各个软件仓库的配置文件。

/etc/yum.conf:

CentOS软件包管理之YUM

/etc/yum.repos.d/media.repo:

CentOS软件包管理之YUM


--------------------------------------------------------------------------------

YUM安装、升级和删除软件包:
# yum {install | update | remove} PACKAGE_NAME ...

示例 1:
软件包的安装:

CentOS软件包管理之YUM

示例 2:
软件包的升级:

CentOS软件包管理之YUM

备注:yum update 后面跟随软件包名,是只检测指定的软件的更新

CentOS软件包管理之YUM

备注:yum update 命令检测系统上所有已安装软件的更新


示例 3:
软件包的删除:

CentOS软件包管理之YUM

--------------------------------------------------------------------------------
YUM安装、升级和删除软件包组:

# yum {groupinstall | groupupdate | groupremove} PACKAGEGROUP_NAME ...
// 安装打印服务包组
// 包组名称之间如果有空格,需要用引号引起来
[root@localhost ~]# yum groupinstall "Print Server"
// 升级打印服务包组
[root@localhost ~]# yum groupupdate "Print Server"
// 删除打印服务包组
[root@localhost ~]# yum groupremove "Print Server"


--------------------------------------------------------------------------------
YUM其他的选项:
# yum list [all | installed | updates | available]
# yum grouplist


//列出所有的软件包
//all可以省略
[root@localhost ~]# yum list all
[root@localhost ~]# yum list
//列出所有已安装的软件包
[root@localhost ~]# yum list installed
//列出所有需要更新的软件包
[root@localhost ~]# yum list updates
//列出所有可用软件包
[root@localhost ~]# yum list available
//列出所有包组
[root@localhost ~]# yum grouplist

# yum repolist [all | enabled | disabled]
//yum repolist默认显示所有enabled软件仓库列表
[root@localhost ~]# yum repolist
//也可以手动指定enabled选项
[root@localhost ~]# yum repolist enabled
//列出所有disabled软件仓库列表
[root@localhost ~]# yum repolist disabled
//列出全部软件仓库列表
[root@localhost ~]# yum repolist all

# yum info [all | installed | updates | available | PACKAGE_NAME]
//显示lftp软件包信息
[root@localhost ~]# yum info lftp
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.hustunique.com
 * extras: mirrors.hustunique.com
 * updates: mirrors.hustunique.com
Installed Packages
Name        : lftp
Arch        : x86_64
Version    : 4.0.9
Release    : 1.el6_5.1
Size        : 2.5 M
Repo        : installed
From repo  : updates
Summary    : A sophisticated file transfer program
URL        :
License    : GPLv3+
Description : LFTP is a sophisticated ftp/http file transfer program. Like bash, it has job
            : control and uses the readline library for input. It has bookmarks, built-in
            : mirroring, and can transfer several files in parallel. It is designed with
            : reliability in mind.
Available Packages
Name        : lftp
Arch        : i686
Version    : 4.0.9
Release    : 1.el6_5.1
Size        : 735 k
Repo        : updates
Summary    : A sophisticated file transfer program
URL        :
License    : GPLv3+
Description : LFTP is a sophisticated ftp/http file transfer program. Like bash, it has job
            : control and uses the readline library for input. It has bookmarks, built-in
            : mirroring, and can transfer several files in parallel. It is designed with
            : reliability in mind.
//其他选项可以显示所有installed、updates、available和全部软件包的信息

# yum groupinfo "PACKAGE_GROUP_NAME"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/18581.html