目錄
1、克隆兩個(gè)虛擬機(jī)
2、安裝 NFS 服務(wù)
3、NFS 服務(wù)使用
1、克隆兩個(gè)虛擬機(jī)
nfs-server
nfs-client(修改ip地址)
[root@xnode1 ~]# cd /etc/sysconfig/network-scripts/
[root@xnode1 network-scripts]# vi ifcfg-eno16777736
#修改內(nèi)容如下
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.224.4(網(wǎng)絡(luò)nat網(wǎng)段)
NETMASK=255.255.255.0
GATEWAY=192.168.224.2
DNS1=8.8.8.8
[root@xnode1 network-scripts]#cd(退出)
[root@xnodel~]#systemctl restart network
?CRT連接(root密碼:000000)
(2)主機(jī)名配置及解釋
[root@demo ~]# hostnamectl set-hostname nfs-server
[root@demo ~]# bash
[root@nfs-server ~]# vi /etc/hosts
#增加
192.168.224.3 nfs-server
192.168.224.4 nfs-client
[root@demo ~]# hostnamectl set-hostname nfs-client
[root@demo ~]# bash
[root@nfs-client ~]# vi /etc/hosts
#增加
192.168.224.3 nfs-server
192.168.224.4 nfs-client
2、安裝 NFS 服務(wù)
[root@nfs-server ~]# yum -y install nfs-utils rpcbind
[root@nfs-client ~]# yum -y install nfs-utils rpcbind
3、NFS 服務(wù)使用
[root@nfs-server ~]# mkdir /mnt/test
[root@nfs-server ~]# vi /etc/exports
#增加
/mnt/test 192.168.224.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)
[root@nfs-server ~]# exportfs -r
nfs-server 端啟動(dòng) NFS 服務(wù),命令如下:
[root@nfs-server ~]# systemctl start rpcbind
[root@nfs-server ~]# systemctl start nfs
nfs-server 端查看可掛載目錄,命令如下:
[root@nfs-server ~]# showmount -e 192.168.224.3
轉(zhuǎn)到 nfs-client 端,在客戶端掛載前,先要將服務(wù)器的 SELinux 服務(wù)和防火墻服務(wù)關(guān)閉, 命令如下:
[root@nfs-client ~]# setenforce 0 [root@nfs-client ~]# systemctl stop firewalld
在 nfs-client 節(jié)點(diǎn),進(jìn)行 NFS 共享目錄的掛載,命令如下:
[root@nfs-client ~]# mount -t nfs 192.168.224.3:/mnt/test /mnt/
查看掛載情況
[root@nfs-client ~]# df -h
4.驗(yàn)證 NFS 共享存儲(chǔ)
[root@nfs-client ~]# cd /mnt/
[root@nfs-client mnt]# ll
total 0
[root@nfs-client mnt]# touch abc.txt
[root@nfs-client mnt]# md5sum abc.txt d41d8cd98f00b204e9800998ecf8427e abc.txt
[root@nfs-server ~]# cd /mnt/test/
[root@nfs-server test]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 30 07:18 abc.txt
[root@nfs-server test]# md5sum abc.txt d41d8cd98f00b204e9800998ecf8427e abc.txt
文章來源:http://www.zghlxwxcb.cn/news/detail-815753.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-815753.html
到了這里,關(guān)于在CentOS 7 中配置NFS服務(wù)器的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!