Linux如何从零开始搭建nfs服务器(centOS6)
Server端
1.打印系统版本
cat /etc/redhat-release
uname -r
uname -m
2.检查是否安装NFS服务
rpm -aq nfs-utils rpcbind
LANG=en
yum install nfs-utils rpcbind -y
rpm -aq nfs-utils rpcbind
3.启动RPC及NFS服务并检查
/etc/init.d/rpcbind status
rpcinfo -p localhost
/etc/init.d/rpcbind start
ps -ef |grep rpc
/etc/init.d/rpcbind status
rpcinfo -p localhost
/etc/init.d/nfs start
rpcinfo -p localhost
4.设置开机自启动检查。
chkconfig nfs on
chkconfig rpcbind on
chkconfig --list nfs
chkconfig --list rpcbind
5.配置共享、data目录
cat >>/etc/exports<<EOF
#shared data for bbs by william at 20171213
/data 172.16.1.0/24(rw,sync)
EOF
cat /etc/exports
6.创建共享目录
mkdir /data
ll /data
chown -R nfsnobody:nfsnobody /data
cat /var/lib/nfs/etab
7.平滑加载NFS服务并检查服务
/etc/init.d/nfs reload === exportfs -rv
showmounts -e localhost
showmounts -e 172.16.1.31
mount -t nfs 182.16.1.31:/data /mnt
umount /mnt
Client 端
1.打印系统版本
cat /etc/redhat-release
uname -r
uname -m
2.检查是否安装NFS服务
rpm -aq nfs-utils rpcbind
LANG=en
yum install nfs-utils rpcbind -y
rpm -aq nfs-utils rpcbind
3.启动RPC及NFS服务并检查
/etc/init.d/rpcbind start
ps -ef |grep rpc
/etc/init.d/rpcbind status
rpcinfo -p localhost
/etc/init.d/nfs start
rpcinfo -p localhost
4.设置开机自启动并检查
chkconfig rpcbind on
chkconfig --list rpcbind
5.检查服务器端的nfs是否ok
shoumount -e 172.16.1.31
排查故障:
a 物理故障 ping 172.16.1.31
b 端口是否开通 telnet 172.16.1.31 111
注意防火墙是否开启阻挡
6.挂载并测试
mount -t nfs 172.16.1.31:/data /mnt
cd /mnt
ls -l
touch william.log
ls -l
echo "mount -t nfs 172.16.1.31:/data /mnt">>/etc/rc.lacal
也可以放在/etc/fstab
posted on 2017-12-21 14:12 William126 阅读(276) 评论(0) 编辑 收藏 举报