ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux平台yum的使用方法

Linux平台yum的使用方法

Linux操作系统 作者:minxuan2013 时间:2014-12-30 13:41:21 0 删除 编辑


    这篇文章是接着前面的文章“尝试使用Redhat6.1”(
http://space.itpub.net/23135684/viewspace-709192)来扩展的,下面通过一个简单的例子演示在本机适用yum工具安装。

1).通过下面的命令将redhat 5.5安装iso文件挂载到/mnt目录:
[root@homeserver bak]# mount -o loop  rhel-server-5.5-x86_64-dvd.iso /mnt

2).在/etc/yum.repos.d/目录下新建rhel.repo文件。

3).在rhel.repo文件中保存如下的内容:
[Server]
name=Red Hat Enterprise Linux $releasever Server - $basearch
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=Red Hat Enterprise Linux $releasever VT - $basearch
baseurl=file:///mnt/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Cluster]
name=Red Hat Enterprise Linux $releasever Cluster - $basearch
baseurl=file:///mnt/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]
name=Red Hat Enterprise Linux $releasever ClusterStorage - $basearch
baseurl=file:///mnt/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

4).使用yum
    完成以上的配置之后即可使用yum来安装相应的工具。例如,yum install samba
使用yum info还可以看到未安装包的详细的信息:
[root@homeserver yum.repos.d]# yum info samba
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Available Packages
Name       : samba
Arch       : x86_64
Version    : 3.0.33
Release    : 3.28.el5
Size       : 16 M
Repo       : Server
Summary    : The Samba SMB server.
URL        :
http://www.samba.org/
License    : GNU GPL Version 2
Description:
           : Samba is the suite of programs by which a lot of PC-related machines
           : share files, printers, and other information (such as lists of
           : available files and printers). The Windows NT, OS/2, and Linux
           : operating systems support this natively, and add-on packages can
           : enable the same thing for DOS, Windows, VMS, UNIX of all kinds, MVS,
           : and more. This package provides an SMB server that can be used to
           : provide network services to SMB (sometimes called "Lan Manager")
           : clients. Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT
           : need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.

    使用yum info命令的时候可以使用通配符查找所有包的相关信息,例如,执行yum info gnome-*命令查看所有以gnome-开头的详细信息,执行yum info gnome-* | grep Name命令查看所有以gnome-开头的包名称。

    /etc/yum.repos.d目录保存了所有的资料库配置文件,这些文件都是repo扩展名文件。创建Linux资料库可以在现有的repo文件上新增内容,也可以新建repo文件。其中的enabled表示是否启用该yum资料库,1表示启用,0表示禁用。name指定名称,baseurl指定rpm的位置。

    Linux的repo配置文件支持file、ftp、http格式,所以可以直接将远程位置指定到repo的配置文件中,这样就可以通过网络在线安装rpm包。在repo文件中加入如下配置:
[Server]
name=Red Hat Enterprise Linux $releasever Server - $basearch
baseurl=ftp://172.10.20.209/repo/rhel5.5/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=Red Hat Enterprise Linux $releasever VT - $basearch
baseurl=ftp://172.10.20.209/repo/rhel5.5/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Cluster]
name=Red Hat Enterprise Linux $releasever Cluster - $basearch
baseurl=ftp://172.10.20.209/repo/rhel5.5/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]
name=Red Hat Enterprise Linux $releasever ClusterStorage - $basearch
baseurl=ftp://172.10.20.209/repo/rhel5.5/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
这是使用ftp方式配置远程的资料库位置。

5).使用yum工具管理Redhat资源组

a).显示系统已经安装的组件,和可以安装的组件:
yum grouplist

    显示Installed Groups和Available Groups分项,只有在上面显示的group才能安装。

b).如果系统安装之初采用最小化安装,没有安装xwindow,那么先安装:
yum groupinstall "X Window System"

c).安装GNOME桌面环境:
yum groupinstall "GNOME Desktop Environment"  

    从RedHat 6高版本开始,GNOME Desktop已经成为默认的Desktop,所以安装GNOME桌面环境的命令是:
yum groupinstall "Desktop"
   从RedHat 6开始,yum命令需要license才能执行,但是Oracle Linux和Centos Linux可正常使用。

d).安装KDE桌面环境:
yum groupinstall "KDE (K Desktop Environment)"

e).卸载GNOME桌面环境:
yum groupremove "GNOME Desktop Environment"

f).卸载KDE桌面环境:
yum groupremove "KDE (K Desktop Environment)"

    除了手动编辑repo文件外,还可以使用Linux命令createrepo直接创建资料库。

6).OEL Oracle Enterprise Linux yum命令特性
        针对OEL Oracle Enterprise Linux还可以简化执行以下的yum命令完成必要包的安装:
如果是OEL5: yum install oracle-validated
如果是OEL6: yum install oracle-rdbms-server-11gR2-preinstall

The pre-install package is available for x86_64 only. Specifically, the package:

Causes the download and installation of various software packages and specific versions needed for database installation, with package dependencies resolved via yum
Creates the user oracle and the groups oinstall and dba, which are the defaults used during database installation
Modifies kernel parameters in /etc/sysctl.conf to change settings for shared memory, semaphores, the maximum number of file descriptors, and so on
Sets hard and soft shell resource limits in /etc/security/limits.conf, such as the number of open files, the number of processes, and stack size to the minimum required based on the Oracle Database 11g Release 2 Server installation requirements
Sets numa=off in the kernel boot parameters for x86_64 machines 
https://blogs.oracle.com/linux/entry/oracle_rdbms_server_11gr2_pre 

参考文章: http://www.itpub.net/thread-1631367-1-1.html 

7).Redhat 6 rhel.repo配置文件
    如果是redhat 6,那么rhel.repo配置文件添加的内容如下:

[mylocalnet]

name=Local Network Repository for RHEL6 $releasever - $basearch

baseurl=file:///mnt/Server

enabled=1

gpgcheck=0


--end--

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29615408/viewspace-1384914/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 尝试使用Redhat 6.1
请登录后发表评论 登录
全部评论

注册时间:2014-12-30

  • 博文量
    112
  • 访问量
    95872