RHEL7部署http应用配置共享yum源

该文章详细介绍了如何在RHEL7系统中,通过关闭防火墙和selinux,然后配置httpd服务,将ISO镜像挂载为yum源,从而提供给其他服务器快速安装rpm包的方法。两种方法包括将ISO镜像挂载到/mnt或/var/www/html/mnt,并通过修改httpd配置来实现yum源的共享。
摘要由CSDN通过智能技术生成

通过采用部署http的方式实现共享yum源,供其它服务器实现rpm的快捷安装。该部署方式也适用于centos服务器。

RHEL7服务器说明
服务器信息说明
192.168.10.110yum源服务主节点
192.168.10.101从节点(从192.168.10.110上获取yum源)

前提条件:

1.两台服务器需关闭防火墙

iptables -F

systemctl stop firewalld

systemctl disable firewalld

systemctl status firewalld

2.两台服务器需要关闭selinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

3.建议重启linux服务器

init 6 或 reboot

方法一:

一、配置192.168.10.110节点

1.mount /dev/cdrom /mnt    -->挂载iso镜像至/mnt

2.cd /etc/yum.repos.d/

cat rhel7.repo

3.清理yum缓存

4.查看yum源

说明yum源配置成功。

6.设置开机自动挂载

vim /etc/fstab

添加:

/dev/cdrom        /mnt         iso9660        defaults        0 0

然后保存退出

7.安装httpd服务

yum install httpd -y

systemctl enable httpd

systemctl restart httpd

systemctl status httpd 

8.httpd配置yum源路径

cd /etc/httpd/conf

vi httpd.conf

把/var/www/html

更改为:

 然后保存退出

9.重启httpd

systemctl restart httpd

systemctl status httpd

10.本机浏览器访问,看到如下界面说明httpd配置yum源成功

 二、配置192.168.10.101使用192.168.10.110yum源

1.cd /etc/yum.repos.d/

cat rhel7.repo

 2.测试

yum clean all

yum list

yum install tcsh

[root@tsps1 yum.repos.d]# yum install zsh
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package zsh.x86_64 0:5.0.2-33.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                          Arch                                Version                                     Repository                            Size
=============================================================================================================================================================
Installing:
 zsh                              x86_64                              5.0.2-33.el7                                rhel7.3                              2.4 M

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total download size: 2.4 M
Installed size: 5.6 M
Is this ok [y/d/N]: y
Downloading packages:
zsh-5.0.2-33.el7.x86_64.rpm                                                                                                           | 2.4 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : zsh-5.0.2-33.el7.x86_64                                                                                                                   1/1 
  Verifying  : zsh-5.0.2-33.el7.x86_64                                                                                                                   1/1 

Installed:
  zsh.x86_64 0:5.0.2-33.el7                                                                                                                                  

Complete!
[root@tsps1 yum.repos.d]# 

这样就实现了apache httpd方式的yum源配置与访问。

 方法二:

一、配置192.168.10.110节点

1.进入/var/www/html目录

2.在该目录下创建mnt目录

 3.mount /dev/cdrom /var/www/html/mnt    -->挂载iso镜像至/var/www/html/mnt

4. 设置开机自动挂载

vim /etc/fstab

添加:

/dev/cdrom        /var/www/html/mnt         iso9660        defaults        0 0

然后保存退出

5.安装httpd服务

yum install httpd -y

systemctl enable httpd

systemctl restart httpd

systemctl status httpd 

6.httpd配置yum源路径

cd /etc/httpd/conf

vi httpd.conf

 然后保存退出

7.重启httpd

systemctl restart httpd

systemctl status httpd

netstat -an|grep 81

 8.本机浏览器访问,看到如下界面说明httpd配置yum源成功

 

 二、配置192.168.10.101使用192.168.10.110yum源

1.cd /etc/yum.repos.d/

cat rhel7.repo

 2.测试

yum clean all

yum list

yum install vsftpd

[root@tsps1 yum.repos.d]# yum install vsftpd
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-25.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                            Arch                               Version                                     Repository                           Size
=============================================================================================================================================================
Installing:
 vsftpd                             x86_64                             3.0.2-25.el7                                rhel7.3                             171 k

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total download size: 171 k
Installed size: 353 k
Is this ok [y/d/N]: y
Downloading packages:
vsftpd-3.0.2-25.el7.x86_64.rpm                                                                                                        | 171 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : vsftpd-3.0.2-25.el7.x86_64                                                                                                                1/1 
  Verifying  : vsftpd-3.0.2-25.el7.x86_64                                                                                                                1/1 

Installed:
  vsftpd.x86_64 0:3.0.2-25.el7                                                                                                                               

Complete!
[root@tsps1 yum.repos.d]# 
 

这样也实现了apache httpd方式的yum源配置与访问。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小黑要上天

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值