YUM(全称为Yellow dog Updater, Modified)是一个在RHEL系操作系统中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须频繁地一次次下载、安装。
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 : http://lftp.yar.ru/ 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 : http://lftp.yar.ru/ 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"
//显示"Print Server"包组信息 [root@localhost ~]# yum groupinfo "Print Server" Loaded plugins: fastestmirror, security Setting up Group Process Loading mirror speeds from cached hostfile * base: ftp.stu.edu.tw * extras: mirrors.hustunique.com * updates: mirrors.hustunique.com Group: Print Server Description: Allows the system to act as a print server. //描述 Mandatory Packages: //必须安装的包 cups printer-filters Default Packages: //默认安装的包 foomatic-db-ppds gutenprint gutenprint-cups hpijs paps
# yum clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
# yum makecache
//清除软件包缓冲 [root@localhost ~]# yum clean packages Loaded plugins: fastestmirror, security Cleaning repos: base extras updates 0 package files removed //清除软件包元数据缓冲 [root@localhost ~]# yum clean metadata Loaded plugins: fastestmirror, security Cleaning repos: base extras updates 13 metadata files removed 9 sqlite files removed 0 metadata files removed //清除过期缓冲 [root@localhost ~]# yum clean expire-cache Loaded plugins: fastestmirror, security Cleaning repos: base extras updates 0 metadata files removed //清除rpmdb数据库 [root@localhost ~]# yum clean rpmdb Loaded plugins: fastestmirror, security Cleaning repos: base extras updates 4 rpmdb files removed //清除补丁缓冲 [root@localhost ~]# yum clean plugins Loaded plugins: fastestmirror, security Cleaning repos: base extras updates //清除所有缓冲 [root@localhost ~]# yum clean all Loaded plugins: fastestmirror, security Cleaning repos: base extras updates Cleaning up Everything //重建缓冲 [root@localhost ~]# yum makecache Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com base | 3.7 kB 00:00 base/group_gz | 220 kB 00:01 base/filelists_db | 5.9 MB 00:44 base/primary_db | 4.4 MB 00:29 base/other_db | 2.8 MB 00:25 extras | 3.4 kB 00:00 extras/filelists_db | 11 kB 00:00 extras/prestodelta | 907 B 00:00 extras/primary_db | 19 kB 00:00 extras/other_db | 5.8 kB 00:00 updates | 3.4 kB 00:00 updates/filelists_db | 1.5 MB 00:17 updates/prestodelta | 156 kB 00:01 updates/primary_db | 2.1 MB 00:19 updates/other_db | 244 kB 00:01 Metadata Cache Created
# yum check-update
# yum update [PACKAGE_NAME] ...
//检测系统已安装软件包是否有更新 [root@localhost ~]# yum check-update Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com initscripts.x86_64 9.03.40-2.el6.centos.1 updates libtiff.x86_64 3.9.4-10.el6_5 updates phonon-backend-gstreamer.x86_64 1:4.6.2-28.el6_5 updates postfix.x86_64 2:2.6.6-6.el6_5 updates psmisc.x86_64 22.6-19.el6_5 updates upstart.x86_64 0.6.5-13.el6_5.2 updates //更新软件包"postfix" [root@localhost ~]# yum update postfix //更新所有可更新的软件包 [root@localhost ~]# yum update
# yum reinstall PACKAGE_NAME ...
//重新安装软件包 [root@localhost ~]# yum reinstall lftp Loaded plugins: fastestmirror, security Setting up Reinstall Process Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Resolving Dependencies --> Running transaction check ---> Package lftp.x86_64 0:4.0.9-1.el6_5.1 will be reinstalled --> Finished Dependency Resolution
# yum history
//查看此前yum操作历史 [root@localhost ~]# yum history Loaded plugins: fastestmirror, security ID | Login user | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 11 | root <root> | 2014-03-01 23:31 | Install | 30 10 | root <root> | 2014-03-01 20:59 | Install | 1 9 | root <root> | 2014-03-01 20:50 | Erase | 1 8 | root <root> | 2014-03-01 20:47 | Install | 1 7 | root <root> | 2014-03-01 20:42 | Erase | 1 EE 6 | root <root> | 2014-03-01 20:41 | Update | 1 < 5 | root <root> | 2014-02-28 17:06 | Install | 1 >< 4 | root <root> | 2014-02-28 15:56 | Install | 8 > 3 | root <root> | 2014-02-28 13:09 | I, U | 115 2 | root <root> | 2014-02-17 17:20 | I, U | 54 1 | System <unset> | 2014-02-17 23:36 | Install | 621 history list