Xiaopei's DokuWiki

These are the good times in your life,
so put on a smile and it'll be alright

User Tools

Site Tools


it:linux:nfs

Table of Contents

NFS

server

ubuntu
$ sudo apt-get install nfs-kernel-server
 
# You can configure the directories to be exported by adding them to the /etc/exports file. For example:
/ubuntu  *(ro,sync,no_root_squash)
/home    *(rw,sync,no_root_squash)
 
# You can replace * with one of the hostname formats. Make the hostname declaration as specific as possible
# so unwanted systems cannot access the NFS mount.
 
#To start the NFS server, you can run the following command at a terminal prompt:
$ sudo service nfs-kernel-server start
centos
$ yum -y install nfs-utils
 
$ systemctl enable nfs-server.service
$ systemctl start nfs-server.service
 
$ mkdir /var/nfs
$ chown nfsnobody:nfsnobody /var/nfs
$ chmod 755 /var/nfs
 
$ vi /etc/exports
/home           192.168.1.101(rw,sync,no_root_squash,no_subtree_check)
/var/nfs        192.168.1.101(rw,sync,no_subtree_check)
 
# Whenever we modify /etc/exports, we must run:
$ exportfs -a

client

$ sudo aptitude install nfs-common
$ sudo mount 10.10.1.10:/mnt  /mnt/nfs
 
# 如果报这种错,就是没装 nfs-common
mount: wrong fs type, bad option, bad superblock on 10.10.1.10:/mnt,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
it/linux/nfs.txt · Last modified: 2017/05/25 11:09 by admin