linux6.4 yum配置

linux yum配置,安裝和管理軟件

實驗環境:

安裝了Red Hat Enterprise Linux 6.4 可運行系統,並且是成功驗證系統。

實驗目標:

掛載光盤,配置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

Loadedplugins: rhnplugin, security

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

Loadedplugins: product-id, refresh-packagekit, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

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.

 

Name        : wireshark

Arch        : x86_64

Version     :1.2.15

Release     : 2.el6_2.1

Size        : 11 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.

 

9、使用yum命令安裝wireshark

[root@cz yum.repos.d]# yum install wireshark

Loadedplugins: product-id, refresh-packagekit, security, subscription-manager

Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.

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

-->Running transaction check

--->Package libsmi.x86_64 0:0.4.8-4.el6 will be installed

 

yum 在安裝過程中會自動處理依賴關係,遇到缺少的軟件包會自動下載並安裝。當屏幕出現Complete 時,表示安裝完成。

總結:

yum 命令是快速安裝軟件的命令,他能解決RPM安裝時出現的多重依賴包的關係,而卻,yum的命令功能要比RPM安裝命令的功能個強大。

附件


yum 主要命令參考手冊

wKioL1P0IXuTEqG2AAF2mI8TFCY334.jpg

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章