“Ubuntu: set nfs server”版本间的差异

来自cslt Wiki
跳转至: 导航搜索
 
(相同用户的11个中间修订版本未显示)
第1行: 第1行:
 
[https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04 How To Set Up an NFS Mount on Ubuntu 14.04]
 
[https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04 How To Set Up an NFS Mount on Ubuntu 14.04]
  
1. install nfs-kernel-server
+
1. install nfs-kernel-server on the host server
    a. sudo apt-get update
+
a) sudo apt-get update
        sudo apt-get install nfs-kernel-server
+
b) sudo apt-get install nfs-kernel-server
 +
 
 +
2. install  nfs-common on the client computer
 +
a) sudo apt-get update
 +
b) sudo apt-get install nfs-common
 +
 
 +
3. edit /etc/exports on the host server to share your folder
 +
a) add "directory_to_share client(share_option1,...,share_optionN)" to /etc/exports
 +
    example: assume your client IP is 111.111.111.111
 +
      /home      111.111.111.111(rw,sync,no_root_squash,no_subtree_check)
 +
      /var/nfs    111.111.111.111(rw,sync,no_subtree_check)
 +
 
 +
4. create the NFS table that holds the exports of your shares and start NFS service
 +
a) sudo exportfs -a
 +
b) sudo service nfs-kernel-server start
 +
 
 +
5. mount the shared folder on the client computer.
 +
a) mount <hostIP>:directory mount_point
 +
    example: assume your mount point is /mnt/nfs/home, hostIP is 111.111.111.111, shared folder is /home
 +
    mount 111.111.111.111:/home /mnt/nfs/home
 +
*    note:
 +
    i. you should keep the username of the server and client the same so that the you have the authority to write
 +
    ii. if you want to write a sh file to mount the folder, please chmod +x <yourfilename>.sh using your username or the owner will change
 +
    iii. you can show the owner by typing: ls -l

2016年9月2日 (五) 04:42的最后版本

How To Set Up an NFS Mount on Ubuntu 14.04

1. install nfs-kernel-server on the host server

a) sudo apt-get update
b) sudo apt-get install nfs-kernel-server

2. install nfs-common on the client computer

a) sudo apt-get update
b) sudo apt-get install nfs-common

3. edit /etc/exports on the host server to share your folder

a) add "directory_to_share client(share_option1,...,share_optionN)" to /etc/exports
    example: assume your client IP is 111.111.111.111
     /home       111.111.111.111(rw,sync,no_root_squash,no_subtree_check)
     /var/nfs    111.111.111.111(rw,sync,no_subtree_check)

4. create the NFS table that holds the exports of your shares and start NFS service

a) sudo exportfs -a
b) sudo service nfs-kernel-server start

5. mount the shared folder on the client computer.

a) mount <hostIP>:directory mount_point
    example: assume your mount point is /mnt/nfs/home, hostIP is 111.111.111.111, shared folder is /home
    mount 111.111.111.111:/home /mnt/nfs/home
  • note:
    i. you should keep the username of the server and client the same so that the you have the authority to write 
    ii. if you want to write a sh file to mount the folder, please chmod +x <yourfilename>.sh using your username or the owner will change
    iii. you can show the owner by typing: ls -l