小编给大家分享一下linux下如何安装nfs服务,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
apt-get install nfs-common nfs-kernel-server
mkdir /mnt/nfs chmod a+w /mnt/nfs
/mnt/nfs *(rw,sync) *(ro,rw)
/etc/init.d/nfs-kernel-server start
mkdir /mnt/nfs mount 192.168.1.99:/mnt/nfs /mnt/nfs
要在客户端每次启动时自动挂载NFS,可以编辑/etc/fstab,添加一行:
192.168.1.99:/mnt/nfs /mnt/nfs nfs rsize=8192,wsize=8192,timeo=14,intr
mkdir -p /mnt/share
yum install -y nfs-utils
vi /etc/exports/mnt/share/ *(rw,no_root_squash,sync) rw表示可读写;sync表示同步写,no_root_squash 客户机用root访问该共享文件夹时,不映射root用户
systemctl start rpcbind systemctl start nfs # 查看状态 systemctl status nfs
systemctl enable rpcbind systemctl enable nfs Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
exportfs –r
exportfs /mnt/share <world>
rpcinfo –p localhost
vim /etc/sysconfig/nfs ##最后面添加如下# 设置nfs固定端口RQUOTAD_PORT=4001 LOCKD_TCPPORT=4002 LOCKD_UDPPORT=4002 MOUNTD_PORT=4003 STATD_PORT=4004
systemctl restart rpcbind systemctl restart nfs
vim /etc/sysconfig/iptables 需放行 111 2049 4001-4004
systemctl restart iptables
yum install -y nfs-utils
systemctl start rpcbind systemctl enable rpcbind
showmount -e 192.168.1.101
mkdir -p /mnt/share mount -t nfs 192.168.1.101:/mnt/share /mnt/share
df -h
vi /etc/fstab192.168.1.101:/mnt/share /mnt/share nfs default 0 0
umount /mnt/share
看完了这篇文章,相信你对“linux下如何安装nfs服务”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。