关闭防火墙执行如下操作
1安装http服务包
[root@centos7 ~]#yum -y install httpd httpd包有依赖性 使用yum安装
[root@centos7 ~]#rpm -ql httpd
……
/usr/lib/systemd/system/httpd.service
……
/var/www/html
[root@centos7 ~]#systemctl start httpd.service
[root@centos7 ~]#systemctl enable httpd.service
[root@centos7 ~]#ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 5 192.168.122.1:53 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 :::80 :::* 80端口打开
LISTEN 0 32 :::21 :::*
LISTEN 0 128 :::22 :::*
[root@centos7 ~]#vim /var/www/html/index.html
[root@centos7 ~]#cat /var/www/html/index.html
<h1>hello,world</h1>
2准备第三方rpm相关包
[root@centos7 html]#mkdir app
[root@centos7 html]cd app
[root@centos7 app]#cp -rf /run/media/root/CentOS\ 7\ x86_64/Packages/* .
[root@centos7 app]#createrepo /var/www/html/app 在app下创建repodata元数据文件包
Spawning worker 0 with 683 pkgs
Spawning worker 1 with 683 pkgs
Spawning worker 2 with 683 pkgs
Spawning worker 3 with 682 pkgs
3搭建客户端
[root@centos7 app]#vim /etc/yum.repos.d/html.repo
[centos-html]
name=repulic
baseurl=http://172.18.254.154/app 仓库路径为repodata的所在目录
gpgcheck=0