dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
阅读:3164回复:7

yum 命令

楼主#
更多 发布于:2014-02-24 16:21
yum 命令

示例:安装本地rpm 包
yum localinstall xxx.rpm

man
localinstall
              Is  used  to install a set of local rpm files. If required the enabled repositories will be used to resolve depen-dencies. Note that the install command will do a local install, if given a filename. This option is maintained for legacy reasons only.

#
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
沙发#
发布于:2014-03-25 18:21
指定源

示例:指定源
yum --enablerepo=elrepo install drbd83-utils kmod-drbd83

参数
--enablerepo=repoidglob
Enables specific repositories by id or glob that have been disabled in the configuration file using the enabled=0 option.

#
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
板凳#
发布于:2014-04-12 11:10
yum groupx命令

示例:yum安装gnome桌面

显示系统已经安装和可以安装的组件
yum grouplist
显示组件信息
yum groupinfo "桌面"
安装GNOME桌面
yum groupinstall "X 窗口系统"
yum groupinstall "桌面"
注意:使用 groupinstall 区分中文或者英文
卸载GNOME桌面
yum groupremove "桌面"


示例:yum安装开发组件
yum grouplist | grep Development
Desktop Platform Development
Development tools
Server Platform Development
yum -y groupinstall "Server Platform Development" "Development tools"

参考

http://kinggoo.com/centos6-4installkde.htm


man
grouplist
Is  used  to list the available groups from all yum repos. Groups are marked as "installed" if all mandatory pack-ages are installed, or if a group doesn’t have any mandatory packages then it is installed if any of the  optional or  default package are installed.  
The optional "hidden" argument will also list groups marked as not being "user visible".
If you pass the -v option, to enable verbose mode, then the groupids are displayed.

groupinstall
Is used to install all of the individual packages in a group, of the specified types (this works as if you’d taken each of those package names and put them on the command line for a "yum install" command).
The group_package_types configuration option specifies which types will be installed.

groupremove
Is used to remove all of the packages in a group, unlike "groupinstall" this will remove everything regardless  of group_package_types.  
It  is worth pointing out that packages can be in more than one group, so "groupinstall X Y" followed by "groupremove Y" does not do give you the same result as "groupinstall X".
The groupremove_leaf_only configuration changes the behaviour of this command to only remove packages which aren’t required by something else.

groupinfo
Is  used  to  give the description and package list of a group (and which type those packages are marked as).
Note that you can use the yum-filter-data and yum-list-data plugins to get/use the data the other way around (Ie.  what groups  own packages need updating).
If you pass the -v option, to enable verbose mode, then the package names are matched against installed/available packages similar to the list command.

#
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
地板#
发布于:2014-07-03 10:16
yumdownloader 下载rpm包
yum 升级或者安装后,会删除下载的rpm包。

配置epel源

详细请参考这里

安装yumdownloader
yum install yum-utils

下载包
yumdownloader libyaml.x86_64 libyaml-devel.x86_64

另一种方法
yum install yum-plugin-downloadonly
yum install php --downloadonly --downloaddir=/tmp

#END
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
4楼#
发布于:2014-07-20 17:40
yum repolist
示例:查看yum 当前源列表

yum repolist

图片:yumlist.png



#END
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
5楼#
发布于:2014-08-06 14:37
设置升级或安装后不删除下载的rpm包
编辑
vim /etc/yum.conf
更改
将 keepcache=0 修改为 keepcache=1

这样,安装或者升级后,在目录 /var/cache/yum 下就会有下载的 rpm 包。
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
6楼#
发布于:2015-01-28 10:40
Error: Cannot retrieve metalink for repository: epel
错误信息
yum makecache
Loaded plugins: fastestmirror, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Determining fastest mirrors
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again


解决方法
sed  -i 's/https/http/g' /etc/yum.repos.d/epel.repo

验证
yum makecache
....省略
epel/pkgtags     | 1.3 MB     00:01    
Metadata Cache Created

参考

#
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
7楼#
发布于:2017-11-07 11:14
yum 历史记录
示例: 查看yum 历史记录
yum history
Loaded plugins: fastestmirror, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    35 | root <root>              | 2017-10-10 18:10 | I, U           |  312 EE
    34 | root <root>              | 2017-05-22 17:13 | Install        |    1  
省略...


扩展: 也可以通过 yum.log 查看
grep 'open' /var/log/yum.log
Oct 10 18:12:32 Updated: openvpn-2.4.3-1.el6.x86_64
Oct 10 18:12:36 Updated: openssl-devel-1.0.1e-57.el6.x86_64
省略...

参数
man yum

history
              The history command allows the user to view what has happened in past transactions (assuming the history_record config. option is set).  You  can  use  info/list/packages-list/packages-
              info/summary to view what happened, undo/redo/rollback to act on that information and new to start a new history file.
#
游客

返回顶部