通过采用部署http的方式实现共享yum源,供其它服务器实现rpm的快捷安装。该部署方式也适用于centos服务器。
RHEL7服务器说明
服务器信息 | 说明 |
192.168.10.110 | yum源服务主节点 |
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]#