您的位置:首页 > 运维架构 > Linux

Linux运维系统工程师系列---12

2014-04-04 08:39 615 查看
yum

yum——Yellowdog Updater Modified

是redhat系列的自动安装工具。
yum是重中之重。

帮助我们自动的解决安装软件的依赖关系

先查看yum是否安装?
[root@server254 Packages]# rpm -qa yum
yum-3.2.29-40.el6.noarch

配置yum源的步骤:
1、挂载正确的光盘
mount —— 挂载
umount —— 卸载
/mnt/cdrom
/dev/sr0

iso9660:国际标准化组织的光盘的格式

2、yum的客户端配置
很简单,五行搞定
[root@server254 ~]# cd /etc/yum.repos.d/
该目录下的文件一定是以.repo结尾的
[root@server254 yum.repos.d]# ls
rhel-source.repo
[root@server254 yum.repos.d]# vim local.repo
[base]#代表的是容器的名字,中括号一定要有,名字不能出现相同的
name=local cdrom #说明性的东西,留给自己或别人看的
baseurl=file:///mnt/cdrom #yum服务器提供安装包的位置,file表示本地路径
enabled=1#表示该段配置是否启用,0禁用。1启用。没有此行,默认启用
gpgcheck=0#是否对软件进行数字签名验证,0表示不验证

file:///mnt/cdrom
网络服务器路径: http://172.16.254.254/iso ftp://172.16.254.254/iso

yum的配置文件:
[root@server254 ~]# rpm -qc yum
/etc/logrotate.d/yum
/etc/yum.conf
/etc/yum/version-groups.conf
yum的应用
——删除本地缓存的yum数据库文件
[root@server254 ~]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base
Cleaning up Everything
——列出yum所管理的所有软件的名字和版本
[root@server254 ~]# yum list
这呢可能会出现的问题:
光驱没给电
光盘不对(镜像不对或者是坏的)
没挂载
——搜索某个软件名称或者是描述的关键字
[root@server254 ~]# yum search gcc
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
=============================== N/S Matched: gcc ===============================
compat-libgcc-296.i686 : Compatibility 2.96-RH libgcc library
gcc-c++.i686 : C++ support for GCC
gcc-gnat.i686 : Ada 95 support for GCC
gcc-java.i686 : Java support for GCC
gcc-objc.i686 : Objective-C support for GCC
——查看软件包信息
[root@server254 ~]# yum info gcc
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Available Packages
Name : gcc
Arch : i686
Version : 4.4.7
Release : 3.el6
Size : 8.2 M
Repo : base
Summary : Various compilers (C, C++, Objective-C, Java, ...)
URL : http://gcc.gnu.org License : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
Description : The gcc package contains the GNU Compiler Collection version 4.4.
: You'll need this package in order to compile C code.
——安装软件包
[root@server254 ~]# yum install 包名1 包名2 …… 包名n
不提示直接安装
[root@server254 ~]# yum -y install 包名1 包名2 …… 包名n
[root@server254 ~]# yum install gcc
[root@server254 ~]# yum install gcc -y
[root@server254 ~]# yum install gcc gcc-c++
——显示软件包组的信息
[root@server254 ~]# yum grouplist
你会看到已安装的包组和可以用的包组
——安装包组
如果没装中文支持,如何做?
[root@server254 ~]# yum groupinstall "Chinese Support" -y
如果没装图形界面,如何做?
[root@server254 ~]# yum groupinstall "Desktop Platform" "X Window System" -y
——查找哪个安装包包含该命令或者文件
查命令:
[root@server254 ~]# yum provides createrepo
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
createrepo-0.9.9-17.el6.noarch : Creates a common metadata repository
Repo : base
Matched from:
[root@server254 ~]# yum provides "*/updatedb.conf"
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base/filelists_db | 3.1 MB 00:00 ...
mlocate-0.22.2-4.el6.i686 : An utility for finding files by name
Repo : base
Matched from:
Filename : /etc/updatedb.conf

mlocate-0.22.2-4.el6.i686 : An utility for finding files by name
Repo : installed
Matched from:
Filename : /etc/updatedb.conf
——卸载软件包(卸载比较危险,你卸载的包可能被别的包依赖,卸载掉了,那个依赖你的包可能就不好用了)
[root@server254 ~]# yum install wireshark -y
[root@server254 ~]# yum erase wireshark

——覆盖安装reinstall(可以用来找回某个包中丢失的文件)
[root@server254 ~]# yum install wireshark*
[root@server254 ~]# which wireshark
[root@server254 ~]# rm -rf /usr/sbin/wireshark
[root@server254 ~]# yum provides "*/wireshark"
wireshark-gnome
[root@server254 ~]# yum reinstall wireshark-gnome
yum clean all:它清除的是哪里的东西?
[root@server254 ~]# cat /etc/yum.conf | grep cache
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
[root@server254 ~]# cd /var/cache/yum/i386/6Server/base
[root@server254 base]# ls
cachecookie
f7c87f40685756b9053252da3f8e4910c23ad818e30216c8f707706bbf081fac-primary.sqlite
gen
packages
productid.gz
repomd.xml
[root@server254 base]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base
Cleaning up Everything
[root@server254 base]# ls
gen packages productid.gz

这是缓存存放目录
[root@server254 base]# pwd
/var/cache/yum/i386/6Server/base
未完待续......
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐