知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

RHEL5建立自己的yum源服务器(基于http方式)

发布时间:2014-09-05 17:25:04作者:知识屋

为了解决软件包的依赖问题,红帽系列发行版最好的方式是利用yum,用rhel安装光盘文件里的文件构建yum源,这里以http方式(还可以本地光盘方式,本地文件方式),本文记录简要过程,仅供参考。
     
    1.挂载安装光盘到系统

mount /dev/cdrom /media/


      2.复制文件到web服务器rhel5目录下

cp -fr /media/* /var/www/htm/rhel5


      3.重建记录分组文件
  首先,确认系统已经安装createrepo包。

cd /var/www/htm/rhel5/Server
rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm


然后重建rpm记录分组文件

createrepo -g /var/www/html/rhel5/VT/repodata/comps-rhel5-vt.xml /var/www/html/rhel5/VT

createrepo -g /var/www/html/rhel5/Cluster/repodata/comps-rhel5-cluster.xml /var/www/html/rhel5/Cluster

createrepo -g /var/www/html/rhel5/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /var/www/html/rhel5/ClusterStorage

createrepo -g /var/www/html/rhel5/Server/repodata/comps-rhel5-server-core.xml /var/www/html/rhel5/Server


     4.在/etc/yum.repos.d目录下建立repo库文件 rhel5-http.repo
        (注:此文件名任意,文件后缀名必须是repo)

cd /etc/yum.repos.d
 

vi rhel5-http.repo
#我的机器IP是为192.168.171.3

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

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

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

[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=http://192.168.171.3/rhel5/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
   5.清除本机yum缓存
yum clean all

    6.测试

yum -y install vim*
 

Quotation
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Package 2:vim-minimal-7.0.109-4.el5_2.4z.i386 already installed and latest version
Package 2:vim-common-7.0.109-4.el5_2.4z.i386 already installed and latest version
Package 2:vim-enhanced-7.0.109-4.el5_2.4z.i386 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package vim-X11.i386 2:7.0.109-4.el5_2.4z set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

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

===========================================================
Package                    Arch                    Version                                  Repository                 Size
================================================================

=============================================================
Installing:
vim-X11                    i386                    2:7.0.109-4.el5_2.4z                     Server                    1.4 M

Transaction Summary
================================================================

=============================================================
Install      1 Package(s)       
Update       0 Package(s)       
Remove       0 Package(s)       

Total download size: 1.4 M
Downloading Packages:
vim-X11-7.0.109-4.el5_2.4z.i386.rpm                                                                   | 1.4 MB     00:00   
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186
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     : vim-X11                                           [1/1]

Installed: vim-X11.i386 2:7.0.109-4.el5_2.4z
Complete!


 
8.配置web服务器,默认目录指定到rhel 源位置.

 

(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜