CentOS 中YUM的用法:
YUM 常用命令:
1.命令:yum check-update -- 列出所有可更新的软件清单
2.命令:yum update -- 安装所有更新软件
3.命令:yum install <package_name> -- 仅安装指定的软件
4.命令:yum update <package_name> -- 仅更新指定的软件
5.命令:yum list -- 列出所有可安裝的软件清单
用 YUM 安装删除软件
装了系统添加删除软件是常事,yum同样可以胜任这一任务,只要软件是rpm安装的。
安装的命令是,yum install xxx,yum会查询数据库,有无这一软件包,如果有,则检查其依赖冲突关系,如果没有依赖冲突,那么最好,下载安装;如果有,则会给出提示,询问是否要同时安装依赖,或删除冲突的包,你可以自己作出判断。
删除的命令是,yum remove xxx,同安装一样,yum也会查询数据库,给出解决依赖关系的提示。
1.命令:yum install <package_name> -- 用YUM安装软件包
2.命令:yum remove <package_name> -- 用YUM删除软件包
用 YUM 查询软件信息
我们常会碰到这样的情况,想要安装一个软件,只知道它和某方面有关,但又不能确切知道它的名字。这时yum的查询功能就起作用了。你可以用 yum search keyword这样的命令来进行搜索,比如我们要则安装一个Instant Messenger,但又不知到底有哪些,这时不妨用 yum search messenger这样的指令进行搜索,yum会搜索所有可用rpm的描述,列出所有描述中和messeger有关的rpm包,于是我们可能得到gaim,kopete等等,并从中选择。
有时我们还会碰到安装了一个包,但又不知道其用途,我们可以用yum info packagename这个指令来获取信息。
1.命令:yum search <keyword> -- 使用YUM查找软件包
2.命令:yum list -- 列出所有可安装的软件包
3.命令:yum list updates -- 列出所有可更新的软件包
4.命令:yum list installed -- 列出所有已安装的软件包
5.命令:yum list extras -- 列出所有已安装但不在 Yum Repository 內的软件包
6.命令:yum list <package_name> -- 列出所指定的软件包
7.命令:yum info <package_name> -- 使用YUM获取软件包信息
8.命令:yum info -- 列出所有软件包的信息
9.命令:yum info updates -- 列出所有可更新的软件包信息
10.命令:yum info installed -- 列出所有已安裝的软件包信息
11.命令:yum info extras -- 列出所有已安裝但不在 Yum Repository 內的软件包信息
12.命令:yum provides <package_name> -- 列出软件包提供哪些文件
清除 YUM 缓存
yum 会把下载的软件包和header存储在cache中,而不会自动删除。如果我们觉得它们占用了磁盘空间,可以使用yum clean指令进行清除,更精确的用法是yum clean headers清除header,yum clean packages清除下载的rpm包,yum clean all一股脑儿端
1.命令:yum clean packages -- 清除缓存目录(/var/cache/yum)下的软件包
2.命令:yum clean headers -- 清除缓存目录(/var/cache/yum)下的 headers
3.命令:yum clean oldheaders -- 清除缓存目录(/var/cache/yum)下旧的 headers
4.命令:yum clean, yum clean all (= yum clean packages; yum clean oldheaders) -- 清除缓存目录(/var/cache/yum)下的软件包及旧的headers
YUM 的帮助信息:
[mchu@host ~]# yum
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
You need to give some command
usage: yum [options] COMMAND
List of Commands:
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
downgrade downgrade a package
erase Remove a package or packages from your system
groupinfo Display details about a package group
groupinstall Install the packages in a group on your system
grouplist List available package groups
groupremove Remove the packages in a group from your system
help Display a helpful usage message
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
localinstall Install a local RPM
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repolist Display the configured software repositories
resolvedep Determine which package provides the given dependency
search Search package details for the given string
shell Run an interactive yum shell
update Update a package or packages on your system
upgrade Update packages taking obsoletes into account
options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C run entirely from cache, don't update cache
-c [config file] config file location
-R [minutes] maximum command wait time
-d [debug level] debugging output level
--showduplicates show duplicates, in repos, in list/search commands
-e [error level] error output level
-q, --quiet quiet operation
-v, --verbose verbose operation
-y answer yes for all questions
--version show Yum version and exit
--installroot=[path] set install root
--enablerepo=[repo] enable one or more repositories (wildcards allowed)
--disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
--disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
--obsoletes enable obsoletes processing during updates
--noplugins disable Yum plugins
--nogpgcheck disable gpg signature checking
--disableplugin=[plugin]
disable plugins by name
--enableplugin=[plugin]
enable plugins by name
--skip-broken skip packages with depsolving problems
--color=COLOR control whether color is used
Plugin Options:
[mchu@host ~]#