您好,登錄后才能下訂單哦!
小編給大家分享一下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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。