Create an nfs server for Ubuntu

Source: Internet
Author: User

With the open-source Linux, many systems based on Linux have been launched. Ubuntu is the most striking one. I started learning about Ubuntu. Here I will mainly summarize the establishment process of the Ubuntu nfs server.

Create a Ubuntu nfs server

During embedded linux development, you often need to use the Ubuntu nfs server for program debugging.

Place the root file system used by the Board in the host directory. The Development Board mounts the system to this directory over Ethernet and

The files in the directory are used as the content of the root file system, so that after the user program is updated, it is no longer necessary to re-burn the root file system of the Board.

The system can be re-used, which can greatly accelerate program debugging. The steps for installing the nfs server in Ubuntu are as follows:

1. Install the NFS server and client:

Sudo apt-get install nfs-kernel-server nfs-common portmap

The purpose of installing the client is to test the Ubuntu nfs server on the local machine.

2 configure portmap

You can choose either of the two methods:

(1): sudo emacs/etc/default/portmap

Remove-I 127.0.0.1

(2) sudo dpkg-reconfigure portmap

Select "no" after running"

In addition, it is very important to use the sysv-rc-conf (instead of chkconfig) tool to check the current nfs and portmap

If off, use sudo sysv-rc-conf portmap on or sudo sysv-rc-conf nfs-kernel-server on

Open

3. Configure the Mount directory and permissions

Emacs/etc/exports

My configuration is as follows:

#/Etc/exports: the access control list for filesystems which may be exported

# To NFS clients. See exports (5 ).

#

# Example for NFSv2 and NFSv3:

#/Srv/homes hostname1 (rw, sync) hostname2 (ro, sync)

#

# Example for NFSv4:

#/Srv/nfs4 gss/krb5i (rw, sync, fsid = 0, crossmnt)

#/Srv/nfs4/homes gss/krb5i (rw, sync)

#

/Nfsboot * (rw, sync)

Explanations:

# Subsequent explanations

/Nfsboot is the shared directory of the Ubuntu nfs server. * indicates that any IP Address can share this directory. You can change it to a restricted IP address, rw

Indicates the permission, and sync indicates the default permission.

4. Update the exports file.

If you change/etc/exports, you cannot update this file through sudo exportfs-r.

5. Restart the NFS service.

Sudo/etc/init. d/portmap start

Sudo/etc/init. d/nfs-kernel-server restart nfs service

6. Test

Try mounting the local disk (My linux system IP address is 202.198.137.18, Mount/home/nfsboot to/mnt)

$ Sudo mount 202.198.137.18:/nfsboot/mnt

Run $ df to check the result

$ Sudo umount/mnt

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.