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) <[email protected]>"
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]#
clip_image002
這個工具的好處就是當管理員離開的時候我們輸入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來安裝更新等等
本文參考
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章