RHCE作业

配置 node02 提供 NFS 服务

  1. 安装 NFS 服务:

    sudo yum install nfs-utils -y
    
  2. 创建共享目录:

    sudo mkdir -p /nfs/rhce
    
  3. 配置 NFS 共享:
    编辑 /etc/exports 文件并添加以下行:

    /nfs/rhce node01(rw,sync,no_root_squash)
    
  4. 启动并启用 NFS 服务:

    sudo systemctl start nfs
    sudo systemctl enable nfs
    

配置 node01 使用 autofs 挂载 NFS 目录

  1. 安装 autofs:

    sudo yum install autofs -y
    
  2. 配置 autofs:
    编辑 /etc/auto.master 文件,添加以下行:

    /- /etc/auto.nfs
    

    创建 /etc/auto.nfs 文件,添加以下行:

    /nfs/rhce -rw,node02:/nfs/rhce
    
  3. 启动并启用 autofs 服务:

    sudo systemctl start autofs
    sudo systemctl enable autofs
    

配置 node01 提供 DNS 服务

  1. 安装 DNS 服务:

    sudo yum install bind bind-utils -y
    
  2. 配置 DNS:
    编辑 /etc/named.conf 文件,确保 listen-onallow-query 设置为您的网络。添加正向区域和反向区域配置:

    zone "rhce.com" IN {
        type master;
        file "/var/named/rhce.com.zone";
        allow-update { none; };
    };
    
    zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "/var/named/192.168.0.zone";
        allow-update { none; };
    };
    
  3. 创建区域文件:
    创建 /var/named/rhce.com.zone 文件,内容如下:

    $TTL 86400
    @   IN  SOA     ns1.rhce.com. root.rhce.com. (
                                2020071001  ; Serial
                                3600        ; Refresh
                                1800        ; Retry
                                604800      ; Expire
                                86400       ; Minimum TTL
                                )
    @   IN  NS      ns1.rhce.com.
    ns1 IN  A       192.168.0.1
    node01 IN A     192.168.0.1
    node02 IN A     192.168.0.2
    

    创建 /var/named/192.168.0.zone 文件,内容如下:

    $TTL 86400
    @   IN  SOA     ns1.rhce.com. root.rhce.com. (
                                2020071001  ; Serial
                                3600        ; Refresh
                                1800        ; Retry
                                604800      ; Expire
                                86400       ; Minimum TTL
                                )
    @   IN  NS      ns1.rhce.com.
    1   IN  PTR     node01.rhce.com.
    2   IN  PTR     node02.rhce.com.
    
  4. 启动并启用 DNS 服务:

    sudo systemctl start named
    sudo systemctl enable named
    

配置 node01 提供 WEB 服务

  1. 安装 Apache 服务:

    sudo yum install httpd -y
    
  2. 配置虚拟主机:
    创建 /etc/httpd/conf.d/rhce.conf 文件,内容如下:

    <VirtualHost *:80>
        ServerName www.rhce.com
        DocumentRoot /nfs/rhce
        <Directory /nfs/rhce>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
        </Directory>
    </VirtualHost>
    
  3. 启动并启用 Apache 服务:

    sudo systemctl start httpd
    sudo systemctl enable httpd
    

确保服务在重启后依然正常运行

  1. 验证 autofs 挂载:

    ls /nfs/rhce
    
  2. 验证 DNS 配置:

    nslookup node01.rhce.com
    nslookup node02.rhce.com
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值