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 主要命令参考手册

本文出自 “陈州-菜鸟之路” 博客,请务必保留此出处http://chenzhou312.blog.51cto.com/8139578/1542449

linux6.4 yum配置,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。