RHCE作业实验

现有主机 node01 和 node02,完成如下需求:
1、在 node01 主机上提供 DNS 和 WEB 服务
2、dns 服务提供本实验所有主机名解析
3、web服务提供 www.rhce.com 虚拟主机
4、该虚拟主机的documentroot目录在 /nfs/rhce 目录
5、该目录由 node02 主机提供的NFS服务共享
6、该目录可以通过autofs服务实现自动挂载
7、所有服务应该在重启之后依然可以正常使用

dns和web配置

[root@localhost ~]# cat /etc/httpd/conf.d/vhost.conf
<directory /nfs>
allowoverride none
require all granted
</directory>
 
<virtualhost 192.168.74.130:80>
documentroot /nfs/rhce
servername www.rhce.com
</virtualhost>

[root@localhost ~]# cat /etc/named.conf
options {
       listen-on port 53 { 192.168.74.130; };
       directory      "/var/named";
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "rhce.com" IN {
        type master;
        file "named.rhce";
};

[root@localhost ~]# cat /var/named/named.rhce
$TTL 1D
@       IN      SOA     @       admin.rhce.com. (  
                                                0 
                                                1
                                                1
                                                1
                                                1)
        IN      NS      ns.rhce.com.
ns      IN      A       192.168.74.130
www     IN      A       192.168.74.130

nfs 

[root@localhost ~]# systemctl enable --now rpcbind
[root@localhost ~]# systemctl enable --now nfs-server.service
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.
[root@localhost ~]# systemctl status rpcbind
● rpcbind.service - RPC Bind
     Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; preset: >
     Active: active (running) since Fri 2024-07-12 01:04:56 CST; 47s ago
TriggeredBy: ● rpcbind.socket
       Docs: man:rpcbind(8)
   Main PID: 2317 (rpcbind)
      Tasks: 1 (limit: 41126)
     Memory: 1.6M
        CPU: 13ms
     CGroup: /system.slice/rpcbind.service
             └─2317 /usr/bin/rpcbind -w -f

Jul 12 01:04:56 localhost.localdomain systemd[1]: Starting RPC Bind...
Jul 12 01:04:56 localhost.localdomain systemd[1]: Started RPC Bind.

[root@localhost ~]# mkdir /nfs/rhce -p
[root@localhost ~]# chmod 777 /rhce/
[root@localhost ~]# firewall-cmd --permanent --add-service=mountd
success
[root@localhost ~]# firewall-cmd --permanent --add-service=rpc-bind
success
[root@localhost ~]# firewall-cmd --reload 
success
[root@localhost ~]#  firewall-cmd --list-services
cockpit dhcpv6-client mountd nfs rpc-bind ssh
[root@localhost ~]# systemctl restart nfs-server.service 
[root@localhost ~]# eportfs -r
-bash: eportfs: command not found
[root@localhost ~]# exportfs -r
[root@localhost ~]# showmount -e 192.168.74.133
Export list for 192.168.74.133:
/rhce 192.168.74.130

自动挂载 

 [root@localhost ~]# vim /etc/auto.master
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc   /etc/auto.misc
/nfs /etc/auto.nfs

[root@localhost ~]# cd /nfs
[root@localhost nfs]# ll
total 0
[root@localhost nfs]# cd rhce  

[root@localhost rhce]# ll

 [root@localhost ~]# cat /etc/auto.nfs
rhce 192.168.74.133:/nfs/rhce

[root@localhost ~]# systemctl restart autofs

[root@localhost ~]# systemctl enable autofs

测试

[root@localhost ~]# curl www.rhce.com

welcome to rhce

[root@localhost ~]# curl www.rhce.com

welcome to rhce

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值