linux yum配置,安裝和管理軟體
實驗環境:
安裝了Red Hat Enterprise Linux 6.4 可運作系統,并且是成功驗證系統。
實驗目标:
挂載CD光牒,配置yum 源,并通過yum 安裝更新軟體。
實驗背景:
你想要将你的系統連接配接到專用yum 庫來安裝和更新軟體。
實驗要求:
1、配置yun
2、嘗試使用yum 的基本文法
3、使用yum 安裝wireshark
實驗詳解:
檢視版本資訊:
[root@desktopX ~]# uname -a
Linux cz2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64GNU/Linux
[root@desktopX ~]# cat /etc/redhat-release
Red HatEnterprise Linux Server release 6.4 (Santiago)
1、打開終端,
以root 使用者的身份登入系統。如果你使用的是圖形化環境,點選[應用程式
(Applications)]->[附件(System Tools)]->[終端(Terminal)]來打開終端:
或者以putty,SecureCRT遠端打開
2、挂載光驅:
[root@desktopX ~]# mount /dev/cdrom /media
mount:block device /dev/sr0 is write-protected, mounting read-only
#mount檢視一下
/dev/sda2on / type ext4 (rw)
proc on/proc type proc (rw)
sysfs on/sys type sysfs (rw)
devpts on/dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on/dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1on /boot type ext4 (rw)
/dev/sda3on /home type ext4 (rw)
none on/proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblockon /var/run/vmblock-fuse type fuse.vmware-vmblock(rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on/var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemonon /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sr0 on /media type iso9660 (ro) //挂載成功
3、編輯/etc/yum.repo.d 下的檔案:
[root@desktopX ~]# cd /etc/yum.repos.d/
[root@desktopX yum.repos.d]# ls
packagekit-media.repo rhel-source.repo
在源檔案内容做如下建立一個新的*.repo檔案
[root@desktopX yum.repos.d]#vi Server.repo
[root@desktopX yum.repos.d]# cat server.repo //檢視編輯内容
[Server]
name=RHEL local Server
baseurl=file:///media/Server
enabled=1
gpgcheck=1 //gpgcheck的參數可以“0,1”如果是零就不掃描下面的檔案
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
注意:如果需要檢查軟體簽名,請設定gpgcheak=1。關于baseurl,如果yum 源在本
地,則使用file://本地位址;如果yum 源在遠端,則應該使用http://或ftp://。
測試
4、進入/media/Packages/ 目錄,安裝createrepo:
[root@desktopX ~]# cd /media/Packages/
[root@desktopX Packages]#rpm -vih createrepo*
warning:createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key IDfd431d51: NOKEY
error:Failed dependencies:
python-deltarpm is needed bycreaterepo-0.9.9-17.el6.noarch
注意:createrepo 是用來建立yum 資料庫的軟體包。
5、清空目前系統儲存的yum 資訊:
[root@desktopX ~]# cd /etc/yum.repo.d
[root@desktopX yum.repo.d]# yumclean all
Loadedplugins: rhnplugin, security
……
注意:每次修改yum 資料庫的内容,就需要清除客戶機緩存資訊,否則會出現不可預
料的錯誤。
6、重新整理yum 源清單:
[root@desktopX yum.repo.d]# yumlist
Thissystem is not registered with RHM.
RHMsupport will be disabled.
7、使用基本的yum指令搜尋軟體wireshark:
[root@cz yum.repos.d]# yum search wireshark
Loadedplugins: product-id, refresh-packagekit, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
============================N/S Matched: wireshark ============================
wireshark-gnome.x86_64: Gnome desktop integration for wireshark and
: wireshark-usermode
wireshark.i686: Network traffic analyzer
wireshark.x86_64: Network traffic analyzer
Name and summary matches only, use "searchall" for everything.
8、檢視wireshark 的詳細資訊:
[root@ desktopX yum.repos.d]# yum info wireshark
AvailablePackages
Name : wireshark
Arch : i686
Version : 1.2.15
Release : 2.el6_2.1
Size : 9.9 M
Repo : Server
Summary : Network traffic analyzer
URL : http://www.wireshark.org/
License : GPL+
Description: Wireshark is a network traffic analyzer for Unix-ish operating
: systems.
:
: This package lays base forlibpcap, a packet capture and filtering
: library, contains command-lineutilities, contains plugins and
: documentation for wireshark. Agraphical user interface is
: packaged separately to GTK+package.
Arch : x86_64
Version :1.2.15
Size : 11 M
: systems.
9、使用yum指令安裝wireshark:
[root@cz yum.repos.d]# yum install wireshark
Settingup Install Process
ResolvingDependencies
-->Running transaction check
--->Package wireshark.x86_64 0:1.2.15-2.el6_2.1 will be installed
-->Processing Dependency: libsmi.so.2()(64bit) for package:wireshark-1.2.15-2.el6_2.1.x86_64
--->Package libsmi.x86_64 0:0.4.8-4.el6 will be installed
yum 在安裝過程中會自動處理依賴關系,遇到缺少的軟體包會自動下載下傳并安裝。當螢幕出現Complete 時,表示安裝完成。
總結:
yum 指令是快速安裝軟體的指令,他能解決RPM安裝時出現的多重依賴包的關系,而卻,yum的指令功能要比RPM安裝指令的功能個強大。