RHEL 5 下使用yum

RHEL 5 下使用yum
Yum(全称为 Yellow dog Updater, Modified)
我们都知道在RHEL5中要想手动的安装gcc的rpm包,他的依赖关系是非常复杂的,而yum就是解决软件的依赖关系的,他就是使用一个中心数据库来管理软件的依赖关系,使我们的安装变得相对简单一些
安装软件yum install 软件名字
安装通常是安装最新版本的,当然这要
删除软件:yum remove 软件名
删除软件时可以选择用remove或者erase remove呢是删除软件,而erase还删除了软件的依赖关系
升级软件:yum upgrade foo或者yum update foo
查询信息:yum info foo
搜索软件(以包含foo字段为例):yum search foo
可以支持通配符搜索的
List 列举安装包的信息
更多详细参数参见man yum
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/cdrom/Server
[root@localhost Server]#
首先我们挂在光盘镜像
进入光盘目录
[root@localhost Server]# rpm -qa yum
yum-3.0.1-5.el5
[root@localhost Server]#
确定已经安装了,yum
[root@localhost Server]# rpm -ivh yum* --aid --force --nodeps
warning: yum-3.0.1-5.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:yum-versionlock ########################################### [ 8%]
2:yum ########################################### [ 15%]
3:yum-changelog ########################################### [ 23%]
4:yum-downloadonly ########################################### [ 31%]
5:yum-kmod ########################################### [ 38%]
6:yum-metadata-parser ########################################### [ 46%]
7:yum-protectbase ########################################### [ 54%]
8:yum-rhn-plugin ########################################### [ 62%]
9:yum-security ########################################### [ 69%]
10:yum-skip-broken ########################################### [ 77%]
11:yum-updateonboot ########################################### [ 85%]
12:yum-updatesd ########################################### [ 92%]
13:yum-utils ########################################### [100%]
[root@localhost Server]#
为了确保所有的yum包都已经正确安装,我在全部安装一下
[root@localhost Server]# rm -rf /etc/yum.conf
[root@localhost Server]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls
rhel-debuginfo.repo rhel-debuginfo.repo~
[root@localhost yum.repos.d]# rm -rf rhel-debuginfo.repo
[root@localhost yum.repos.d]#
删除原来的配置文件
[root@localhost yum.repos.d]# vi /etc/yum.conf
新建一个文件,这个文件如何写,会在后面的附件中上传
[root@localhost yum.repos.d]# ping www.baidu.com
PING www.a.shifen.com (119.75.213.61) 56(84) bytes of data.
64 bytes from 119.75.213.61: icmp_seq=1 ttl=52 time=23.4 ms
64 bytes from 119.75.213.61: icmp_seq=2 ttl=52 time=25.0 ms
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 23.471/24.240/25.009/0.769 ms
[root@localhost yum.repos.d]#
确定上网环境
[root@localhost yum.repos.d]# yum install -y vlock
我们安装一个vlock工具试试
这里的-y指的是不用询问,直接安装
Loading "downloadonly" plugin
Loading "security" plugin
Loading "rhnplugin" plugin
Loading "kmod" plugin
Loading "protectbase" plugin
Loading "skip-broken" plugin
Loading "changelog" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 2.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 202 B 00:00
primary.xml.gz 100% |=========================| 893 kB 00:24
################################################## 2535/2535
primary.xml.gz 100% |=========================| 201 B 00:00
primary.xml.gz 100% |=========================| 107 kB 00:01
################################################## 324/324
0 packages excluded due to repository protections
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vlock to pack into transaction set.
vlock-1.3-23.i386.rpm 100% |=========================| 4.9 kB 00:00
---> Package vlock.i386 0:1.3-23 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
vlock i386 1.3-23 base 11 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 11 k
Downloading Packages:
(1/1): vlock-1.3-23.i386. 100% |=========================| 11 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <centos-5-key@centos.org>"
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vlock ######################### [1/1]
Installed: vlock.i386 0:1.3-23
Complete!
[root@localhost yum.repos.d]#
RHEL 5 下使用yum
这个工具的好处就是当管理员离开的时候我们输入vlock后电脑就进入锁定状态了
只有输入管理员密码.我们才能进入
如果我们不喜欢用了.我们就用remove来删除它
[root@localhost yum.repos.d]# yum remove -y vlock
Loading "downloadonly" plugin
Loading "security" plugin
Loading "rhnplugin" plugin
Loading "kmod" plugin
Loading "protectbase" plugin
Loading "skip-broken" plugin
Loading "changelog" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package vlock.i386 0:1.3-23 set to be erased
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Removing:
vlock i386 1.3-23 installed 11 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 1 Package(s)
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Removing : vlock ######################### [1/1]
Removed: vlock.i386 0:1.3-23
Complete!
You have mail in /var/spool/mail/root
[root@localhost yum.repos.d]#
下面在贴一个搜索的实例
[root@localhost yum.repos.d]# yum list -y mysql
Loading "downloadonly" plugin
Loading "security" plugin
Loading "rhnplugin" plugin
Loading "kmod" plugin
Loading "protectbase" plugin
Loading "skip-broken" plugin
Loading "changelog" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 2.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
0 packages excluded due to repository protections
Available Packages
mysql.i386 5.0.77-3.el5 base
[root@localhost yum.repos.d]#
比如我们搜索一下,mysql ,当然这里的版本呢要取决于你的更新服务器的更新程度了
我们还可以使用check-update 来检测更新
利用update来安装更新等等
本文参考

附件:http://down.51cto.com/data/2354391



本文转自 yuzeying1 51CTO博客,原文链接:http://blog.51cto.com/yuzeying/218619

上一篇:还有什么不能做?——细谈在C#中读写Excel系列文章之一


下一篇:使用SAP Analytics Cloud显示全球新冠肺炎确诊人数和发展趋势的预测