Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1114623
  • 博文数量: 309
  • 博客积分: 6093
  • 博客等级: 准将
  • 技术积分: 3038
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-03 17:14
个人简介

linux学习记录

文章分类

全部博文(309)

文章存档

2014年(2)

2012年(37)

2011年(41)

2010年(87)

2009年(54)

2008年(88)

分类:

2010-08-25 15:38:46

                      RHCE学习笔记

 

篇只讨论RHEL 5系列的YUM(仓库)配置,YUMRPM的其它细节可以参考下面:

http://blog.chinaunix.net/u3/111899/showart_2197784.html

 

关于linux下面yum仓库的配置,

 

Yum介绍

Yum全称为 Yellow dog Updater, Modified(软件包管理器)

主要功能是更方便的添加/删除/更新RPM包, yum很好的解决了linux下面安装软件包的依赖性关系。很强大哦! 他能便于管理大量系统的更新问题  ,能同时设置多个资源库(Repository),而且使用起来十分的方便。

 

详细讲解如何在RHEL5.4上面配置仓库的方法

我们利用FTP的方式来制作yum的安装源

先将光盘中的ftprpm软件包copy/tmp目录下面,

[root@localhost ~]#

[root@localhost ~]# cd /media/RHEL_5.4\ i386\ DVD/Server/

[root@localhost Server]#

[root@localhost Server]# ls | grep vsftpd

vsftpd-2.0.5-16.el5.i386.rpm

[root@localhost Server]# cp vsftpd-2.0.5-16.el5.i386.rpm /tmp/

[root@localhost Server]# cd /tmp/

[root@localhost tmp]# ls

vsftpd-2.0.5-16.el5.i386.rpm

[root@localhost tmp]#

由于yum仓库还没有配置,可以用rpm的方式来安装ftp

[root@localhost tmp]# rpm -ivh vsftpd-2.0.5-16.el5.i386.rpm

warning: vsftpd-2.0.5-16.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... ########################################### [100%]

1:vsftpd      ########################################### [100%]

[root@localhost tmp]#

FTP服务就安装成功了。

安装完FTP服务以后。默认会产生一个/var/ftp/pub的目录。

[root@localhost pub]#

[root@localhost ~]# cd /var/ftp/pub/

[root@localhost pub]# ls

[root@localhost pub]#

现在这个目录里面什么东西都没有,我们将光盘里面的东西copy到这里目录下面来。

[root@localhost ~]#

[root@localhost ~]# cd /var/ftp/pub/

[root@localhost pub]# ls

Cluster  ClusterStorage  Server  VT

[root@localhost pub]#

可以看到,在/var/ftp/pub目录下面已经有了这四个文件夹

现在启动一下ftp服务

[root@localhost ~]#

[root@localhost ~]# service vsftpd restart

Shutting down vsftpd:                                        [  OK  ]

Starting vsftpd for vsftpd:                                   [  OK  ]

[root@localhost ~]#

 

现在就来配置yum仓库,

Yum仓库在/etc/yum.repod目录下面,(文件名必须以.repo结尾)

[root@localhost ~]#

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# ls

rhel-debuginfo.repo

[root@localhost yum.repos.d]#

/etc/yum.repos.d这个目录里面有一个rhel-debuginfo.repo的模板文件,

可以按照这个文件里面的内容来配置yum仓库。

[rhel-debuginfo]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

这个就是rhel-debuginfo.repo的模板文件里面的内容,

 

我们可以按照这个里面的内容来编写。

[Server]
name=Red Hat Enterprise Linux Server
baseurl=ftp://192.168.0.254/pub/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Cluster]
name=Red Hat Enterprise Linux Cluster
baseurl=ftp://192.168.0.254/pub/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=Red Hat Enterprise Linux ClusterStorage
baseurl=fttp://192.168.0.254/pub/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=Red Hat Enterprise Linux VT
baseurl=fttp://192.168.0.254/pub/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

这个就是整个yum仓库的配置内容。

 

下面讲解yum仓库中每一行的意义

[Server] 

这个是指仓库的名称,可以随意命名,但是每个仓库的名字不要重复

Name    

这个只是对仓库进行的一个描述,也可以随意些,但要有意义

Baseurl   

这个很重要,这个是指定路径,可以用fileftphttp 用后面两个必

须开启相应的服务。File可以用来做本地仓库。一定要保证路径可达

Enabled=0  or  1  

这个相当于开关,如果等于1,代表开启。0则关闭,开启是指是否要去读这个文件,关闭则不去读这个文件

Gpgcheck=0  or  1

与上面一样。是指安装软件包的时候检查数字签名,检查软件包的完整性。

Gpgkey          

开启gpgcheck后,通过gpgkey来指定,相应的gpg文件

如果不指定gpgkey文件,那么就必须手动的导入相应的gpg文件,

Rpm –import  /etc/pki/rpm-gpg/RPM-GPG-KEY-redehat-release

必须手动的敲入这条命令。

RHEL发行版安装好后会将相应的gpgkey放在/etc/pki/rpm-gpg目录下面。

Yum仓库中每一行参数都已经介绍完毕了

 

下面进行装包测试

[root@localhost ~]# yum -y install bind

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package bind.i386 30:9.3.6-4.P1.el5 set to be updated

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package       Arch          Version                      Repository       Size

================================================================================

Installing:

 bind          i386          30:9.3.6-4.P1.el5            Server          978 k

 

Transaction Summary

================================================================================

Install           1 Package(s)        

Update        0 Package(s)        

Remove       0 Package(s)        

 

Total download size: 978 k

Downloading Packages:

bind-9.3.6-4.P1.el5.i386.rpm                             | 978 kB     00:00    

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186

Server/gpgkey                                                    | 1.1 kB     00:00    

Importing GPG key 0x37017186 "Red Hat, Inc. (release key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : bind                                                     1/1

 

Installed:

  bind.i386 30:9.3.6-4.P1.el5                                                  

 

Complete!

[root@localhost ~]#

 

Yum仓库就已经配置成功了,我们的软件包已经可以正常的安装了。

 

linux下面配置yum仓库的讨论就到这里了。

 

阅读(953) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~