CentOS5.6构建本地源YUM服务

下面是CentOS下构建YUM的步骤

1.首先把镜像盘挂在上:mount /dev/cdrom /media/cdrom/

2.安装http的包,  rpm -ivh /media/cdrom/CentOS/httpd-2.2.3-45.el5.centos.x86_64.rpm

 3.安装YUM常用的RPM包(有的包是默认已经安装的,但也要查一下是否安装)

  rpm -ivh /media/cdrom/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm

   rpm -ivh /media/cdrom/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm

   rpm -ivh /media/cdrom/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

   rpm -ivh /media/cdrom/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm

 4.新建一个自定义的目录,用来放置你的RPM包,也是http访问的目录:/data/CentOS/x64/

将挂在的rpm包的集合复制一份到/data/CentOS/x64/下,(因为你不可能挂在你的镜像盘一辈子)

 cp -rf /media/cdrom/CentOS/ /data/CentOS/x64/

5.将/media/cdrom下的repodata/ 拷贝到/data/CentOS/x64/CentOS下

 cp -rf /media/cdrom/repodata/ /data/CentOS/x64/CentOS/       (后面会用到的)

6.安装rpm -ivh /media/cdrom/CentOS/createrepo-0.4.11-3.el5.noarch.rpm  (此包是用来安装服务端设置软件仓库及信息文件)

 rpm -ivh /media/cdrom/CentOS/createrepo-0.4.11-3.el5.noarch.rpm

7.先把http服务启动,service httpd start ,如果这个服务不能搞定,其他的一切都是做无用功)

 netstat -anpt | grep 80

tcp        0      0 :::80                       :::*                        LISTEN      8389/httpd

 8.生成客户端所需的信息文件

createrepo  -g /media/cdrom/repodata/comps.xml /data/CentOS/x64/

9.将key文件(用于客户端与服务端的认证)拷入指定目录/data/CentOS/x64 下

cp /media/cdrom/RPM-GPG-KEY-CentOS-5 /data/CentOS/x64/

10.修改http服务的配置文件,如何你是默认安装的httpd,其配置文件路径为:

vi /etc/httpd/conf/httpd.conf

 修改一下两行即可:(显示的是更改后的)

DocumentRoot "/data/CentOS/"

<Directory "/data/CentOS/">

之后保存,退出。。重启httpd服务、、、service httpd restart

 

11.用你的IE浏览器浏览下,看能不能访问http://10.20.220.251/x64/CentOS/ 下面显示的是rpm包算是正却的

 

12.更改yum的配置文件,更改之前要做好备份

、cp CentOS-Base.repo CentOS-Base.repo.bak

 之后清空你的CentOS-Base.repo 文件

方法:> CentOS-Base.repo  即可

vi CentOS-Base.repo

 [base]

name=CentOS5.3-base

baseurl=http://10.20.220.251/x64/

enable=1

gpgcheck=1

gpgkey=http://10.20.220.251/x64/RPM-GPG-KEY-CentOS-5

这样即可了

下面就是测试了。。。

先执行下yum clean all

之后验证下

 [root@localhost yum.repos.d]# yum -y install vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.0.5-16.el5_5.1 set to be updated
base/filelists                                                              | 3.4 MB     00:00     
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package              Arch                 Version                        Repository          Size
===================================================================================================
Installing:
 vsftpd               x86_64               2.0.5-16.el5_5.1               base               139 k

Transaction Summary
===================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 139 k
Downloading Packages:
vsftpd-2.0.5-16.el5_5.1.x86_64.rpm                                          | 139 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vsftpd                                                                      1/1

Installed:
  vsftpd.x86_64 0:2.0.5-16.el5_5.1                                                                 

Complete!

你可能感兴趣的:(职场,构建,休闲,centos5.6,本地源YUM服务)