linux yum 命令
yum( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。
基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。
yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。
yum 语法
yum [options] [command] [package …]
- options:可选,选项包括-h(帮助),-y(当安装过程提示选择全部为"yes"),-q(不显示安装的过程)等等。
- command:要进行的操作。
- package操作的对象。
yum常用命令
- 1.列出所有可更新的软件清单命令:yum check-update
- 2.更新所有软件命令:yum update
- 3.仅安装指定的软件命令:yum install <package_name>
- 4.仅更新指定的软件命令:yum update <package_name>
- 5.列出所有可安裝的软件清单命令:yum list
- 6.删除软件包命令:yum remove <package_name>
- 7.查找软件包 命令:yum search <keyword>
- 8.清除缓存命令:
- yum clean packages: 清除缓存目录下的软件包
- yum clean headers: 清除缓存目录下的 headers
- yum clean oldheaders: 清除缓存目录下旧的 headers
- yum clean, yum clean all (= yum clean packages; yum clean oldheaders) :清除缓存目录下的软件包及旧的headers
实例1
安装 pam-devel
[root@localhost ~]# yum -y install pam-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.sohu.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.sohu.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pam-devel.x86_64 0:1.1.1-24.el6 will be installed
--> Processing Dependency: pam = 1.1.1-24.el6 for package: pam-devel-1.1.1-24.el6.x86_64
--> Running transaction check
---> Package pam.x86_64 0:1.1.1-17.el6 will be updated
---> Package pam.x86_64 0:1.1.1-24.el6 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================
Package Arch Version Repository Size
======================================================================================
Installing:
pam-devel x86_64 1.1.1-24.el6 base 205 k
Updating for dependencies:
pam x86_64 1.1.1-24.el6 base 659 k
Transaction Summary
省略...
实例2
移除 pam-devel
[root@localhost ~]# yum -y remove pam-devel
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package pam-devel.x86_64 0:1.1.1-24.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================
Package Arch Version Repository Size
======================================================================================
Removing:
pam-devel x86_64 1.1.1-24.el6 @base 547 k
Transaction Summary
======================================================================================
Remove 1 Package(s)
省略...
实例3
利用 yum 的功能,找出以 pam 为开头的软件名称有哪些?
[root@localhost ~]# yum list pam*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.sohu.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.sohu.com
Installed Packages
pam.x86_64 1.1.1-24.el6 @base
Available Packages
pam.i686 1.1.1-24.el6 base
pam-devel.i686 1.1.1-24.el6 base
pam-devel.x86_64 1.1.1-24.el6 base
pam_krb5.i686 2.3.11-9.el6 base
pam_krb5.x86_64 2.3.11-9.el6 base
pam_ldap.i686 185-11.el6 base
pam_ldap.x86_64 185-11.el6 base
pam_passwdqc.i686 1.0.5-8.el6 base
pam_passwdqc.x86_64 1.0.5-8.el6 base
pam_pkcs11.i686 0.6.2-15.el6 base
pam_pkcs11.x86_64 0.6.2-15.el6 base
pam_ssh_agent_auth.i686 0.9.3-123.el6_9 updates
pam_ssh_agent_auth.x86_64 0.9.3-123.el6_9
经过近段时间学习 linux 基础知识相信大家已经对 linux 有了一定了了解,接下来我们将一起学习 linux 中一些环境搭建的实例。