Install and Configure nfs on Ubuntu

Source: Internet
Author: User

The nfs installation and configuration on Ubuntu does not have the nfs service by default, so you need to install 1, install nfs service edition apt-get install nfs-kernel-server2, modify nsf configuration file www.2cto.com vi/etc/exports add nfs Directory format in the file as follows/armnfs * (sync, rw) Save the disk and exit 3. Create the nsf directory mkdir/armnfs under the root directory to modify the directory permission chmod 777-R/armnfs4, and restart nfs/etc/init. d/nfs-kernel-server restart 5. Use mount-o nolock 192.168.1.99 when testing nsf mount 192.168.1.99:/armnfs/abc embedded: /armnfs/new8120/mnt/net Note: ww in Kernel configuration Optional 2cto.com Networking options ---> enable TCP/IP networking in the options enable IP: kernel level autoconfiguration General setup ---> Option, Default kernel command string: (Default kernel command line) add the green character root =/dev/nfs rw nfsroot = 192.168.1.99: /armnfs/ip = 192.168.1.201 init =/linuxrc console = ttyS0 File system ---> Network File System ---> Option Enable NFS file system support enable Provide NFSv3 client support enable Root file system on NFS nfs configuration: Less/etc/exports/home/xx/192.168.0. * (rw, sync) $ sudo/etc/init. d/portmap start * Starting portmap daemon... * Already running. [OK] $ sudo/etc/init. d/nfs-common start * Starting NFS common utilities [OK] $ sudo/etc/init. d/nfs-kernel-server start * Exporting directories for NFS kernel daemon... exportfs:/etc/exports [2]: Neither 'subtree _ check' or 'no _ subtree_check 'specified for export "192.168.0. *:/home/xx /". www.2cto.com Assuming default behaviour ('subtree _ check '). NOTE: this default will change with nfs-utils version 1.1.0 [OK] * Starting NFS kernel daemon [OK] $ showmount-e Export list for Qunhome:/home/xx 192.168.0. * It seems to be okay, but: sudo mount 192.168.0.100:/home/xx/mnt mount: 192.168.0.100:/home/xx failed, reason given by server: Permission denied I installed 7.04, the same problem with you. When I use 6.06, there is no problem. I don't know if it is a 7.04 bug. When I configure portmap, the host is not found in the etc directory. allow and hosts. deny files: I created these two files myself. I used to remember the files under the etc directory. Write your IP address under/etc/exports. Do not enter the * number. For example: (/home/zwg IP (rw, sync, no_root_squash) the reason may be that there are no hosts. allow and hosts. deny files in the etc directory. I installed 7.04, And you encountered the same problem. I used to use 6.06, but I don't know if it was a 7.04 bug. When configuring portmap, the host is not found in the etc directory. allow and hosts. deny files: I created these two files myself. I used to remember the files under the etc directory. Thank you very much! I deleted the installation file and all the related configuration files and then re-submitted them step by step. The final successful modification was as follows: replace IP lists in/etc/hosts. * There is another method: there are no major problems with the installation and configuration. Add the no_subtree_check option in brackets to reduce the file sharing access check. If your shared directory does not have many local read/write requests (man exports ). On the master node, edit your/etc/hosts. allow file to allow connections from slave nodes. if your cluster LAN is on 192.168.1.0/24, your hosts. allow will look like: Code Listing 2.10: hosts. allow www.2cto.com portmap: 192.168.1.0/255.255.255.0 Edit the/etc/exports file of the master node to export a work directory structure (/home is good for this ). code Listing 2.11:/etc/exports/home/* (rw) Delete osts. deny. The subnet is represented by a mask. Network File System (NFS) allows you to share directories of different hosts (OS) over the Network-you can mount directories of remote hosts through NFS, accessing this directory is like accessing a local directory! Generally, nfs can be used to easily share unix-like systems. However, to share unix-like systems with windows systems, samba must be used! Based on SUN's Remote Procedure Call (Remote Procedure Call), RPC defines a system-independent method for inter-process communication. therefore, the NFS server can also be viewed as an RPC server. because NFS is an RPC service program, you must map the port before using it-set it through portmap. for example, when an NFS client initiates an NFS service request, it must first obtain a port ). therefore, it first obtains the port number through portmap. (not only NFS, but portmap needs to be set before all RPC service programs start.) Several NFS-related files, command 1, the access to the NFS volume by/etc/exports is approved by exports, which enumerate several hostnames that have the right to access the file system on the NFS server. 2./sbin/exportfs maintains NFS resource sharing. you can use it to reset/etc/export S shared directory, uninstall the NFS Server shared directory or share it again. 3./usr/sbin/showmount is used on the NFS Server, while showmount is mainly used on the Client. showmount can be used to view NFS shared directory resources. www.2cto.com 4,/var/lib/nfs/xtab NFS record document: You can view which clients are connected to the NFS host. the following are not directly responsible for NFS. In fact, they are responsible for all RPC5,/etc/default/portmap. In fact, portmap is responsible for ing all RPC service ports, its content is very simple (detailed later) 6,/etc/hosts. deny: Set host 7,/etc/hosts that rejects the portmap service. allow settings allow hosts of the portmap service to install NFSDebian/Ubuntu by default. If an NFS server is installed, first install the NFS service program: $ sudo apt-get install nfs-kernel-server (when nfs-kernel-server is installed, apt will automatically install nfs-common and portmap) so that the host is equivalent to the NFS Server. Similarly, if the target system is an NFS client, you must install the NFS client program. For Debian/Ubuntu systems, nfs-common must be installed. $ Sudo apt-get install nfs-commmon nfs-common and nfs-kernel-server both depend on portmap! Configure NFS portmap Method 1: edit/etc/default/portmap and remove-I 127.0.0.1. method 2: $ sudo dpkg-reconfigure portmap, shocould portmap be bound to the loopback address? Select N. configure/etc/hosts. deny (prohibit any host from connecting to your NFS server), add: ### nfs daemons portmap: ALL lockd: ALL mountd: ALL rquotad: ALL statd: ALL configuration/etc/hosts. allow allows the hosts you want to establish connections with your NFS server. The following steps allow any host whose IP address starts with 192.168.2 (connected to the NFS server), or specify a specific IP address. See hosts_access (5) and hosts_options (5) on the man page ). Add: ### nfs daemons www.2cto.com portmap: 192.168.2. lockd: 192.168.2. rquotad: 192.168.2. mountd: 192.168.2. statd: 192.168.2. /etc/hosts. deny and/etc/hosts. allow sets the access to portmap. using these two configuration files is a bit similar to "mask. now/etc/hosts. deny prohibits all users from accessing portmap. then in/etc/hosts. some users are allowed to access portmap in allow. run $ sudo/etc/init. d/portmap restart portmap daemon. configure the/etc/exportsNFS Mount directory and permission defined by the/etc/exports file. For example Are directory to make 192.168.2. * Add the following statement at the end of the file:/home/zp/share 192.168.2. * (rw, sync, no_root_squash) or:/home/zp/share 192.168.2.0/24 (rw, sync, no_root_squash) 192.168.2. * The NFS client in the network segment can share the contents of the NFS server/home/zp/share directory. the user has the read and write permissions, and the user's identity after entering the/home/zp/share directory is better to add sync to the root user; otherwise, a warning will be given when $ sudo exportfs-r, sync is the default option for NFS. (run $ showmount-e to view the NFS server's export list. if/etc/exports is changed, run $ sudo exportfs-r to update and run $ sudo/etc/init.. D/nfs-kernel-server restart nfs service) www.2cto.com/etc/exports is actually the core configuration file of the nfs server. laruence's Linux private dish lists the writing methods of some exports files. to test NFS, try mounting a local disk (assuming that the IP address of the local host is 192.128.2.1, mount/home/zp/share to/mnt) $ sudo mount 192.168.2.1: /home/zp/share/mnt run $ df check the result $ sudo umount/mnt pay attention to the read/write permissions of the copied file! In addition, some parameters can be used: mount-o nolock, rsize = 1024, wsize = 1024, timeo = 15 192.168.2.130:/tmp/
Author neo600

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.