yum源服务器搭建

1、安装httpd和php

yum install -y httpd

yum install -y php

我们需要手动去配置 httpd 的相关参数,配置文件的位置: /etc/httpd/conf
参数说明见下表
参数说明当前配置
ServerName 服务器的地址信息 http://192.168.1.100:10009
DocumentRoot http文件服务器的下载目录 /package
Listen 监听的端口 10009
Directory 服务器文件 /package(与 DocumentRoot 文件一致)

在设定的Directory下新建test.php

加开机自自动chkconfighttpd on

service httpd start

浏览器访问http://localhost:port/test.php ---ok

2、在Directory下上传/rhel-server-6.8/Packages

浏览器访问:http://localhost:port/rhel-server-6.8/Packages  ---ok

3.安装createrepo,此程序主要用于生成创建yum仓库,创建索引信息。

yum install createrepo
createrepo /data/resource/rhel-server-6.8

到这里我们已经完成了yum源服务器的配置。

可以查看在 /data/resource/rhel-server-6.8 多了repodata文件夹

4、我们到客户端进行测试:

[root@IP70-CentOS7 ~]# >>vim /etc/yum.repos.d/Local.repo

vi redhat6.8.repo

 [RedHat6.8]

name= RedHat6.8
baseurl= http://xx.xx.xx.236:11080/rhel-server-6.8/
enabled=1
gpgcheck=0

然后执行

yum clean all 

yum makecache
yum repolist

 至此配置完成。

原文地址:https://www.cnblogs.com/zhxiaoxiao/p/10233135.html