NFS服务的搭建及挂载

1.NFS软件的安装

NFS服务有两个必须的软件包①nfs-utils,NFS主程序②rpcbind,RPC主程序;

查看NFS软件包

[root@NFS ~] # rpm -qa | egrep "nfs|rpcbind"

yum源配置好后,直接用yum安装

[root@NFS ~] # yum list | grep  nfs-utils          #查看安装包是否存在

[root@NFS ~] # yum list | grep rpcbind

[root@NFS ~] # yum install nfs-utils  rpcbind     #安装

2.启动NFS服务

启动NFS服务之前先需要先启动rpcbind服务

[root@NFS ~] # systemctl restart  rpcbind              #重启服务

[root@NFS ~] # netstat -tlunp |grep rpcbind            #查看端口

[root@NFS ~] # systemctl start nfs                            #启动nfs服务

[root@NFS ~] # systemctl enable nfs                        #设置nfs服务开机自启

3.配置NFS服务

修改配置文件/etc/exports

[root@NFS ~] #  vi /etc/exports

/nfs              192.168.100.0/24(rw,sync,all_squash)    #读写权限rw,同步更新sync,压缩来访账号all_squash,

#[共享目录]   [客户端地址1(权限)]        [客户端地址2(权限)]

[root@NFS ~] #  /etc/init.d/nfs reload      #重新读取配置文件

 

4.客户端挂载

[root@NFS ~] # mount -t nfs 192.168.100.1:/nfs /nfsdisk

[root@NFS ~] # df -h     #查看挂载情况

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章