Build an NFS server on centos6.5

Source: Internet
Author: User

Build an NFS server on centos6.5

Project Background:

Set up an NFS network server !!!

Test environment:

Vmware workstation 11

Under centos6.5

NFS server: ip: 192.168.0.36 iptables disable setenforce 0

NFS client: ip: 192.168.0.39iptables disable setenforce 0

SecureCRT (ssh remote connection software)

Experiment process:

I. Software Installation

Server:

[Root @ real_server02 ~] # Yum install-y nfs-utils rpcbind

Client:

[Root @ user ~] # Yum install-y nfs-utilsrpcbind

Ii. Server Side settings:

1. [root @ real_server02 ~] # Vim/etc/exports

/Home/www 192.168.0. * (rw, sync, no_root_squash)

Add the line above. Save and exit!

2. Create a test directory

[Root @ real_server02 ~] # Mkdir/home/www

3. Start NFS on the server

[Root @ real_server02 www] #/etc/init. d/rpcbind start

Starting rpcbind: [OK]

[Root @ real_server02 www] #/etc/init. d/nfs start

Starting NFS services: [OK]

Starting NFS quotas: [OK]

Starting NFS mountd: [OK]

Starting NFS daemon: [OK]

Starting RPC idmapd: [OK]

[Root @ real_server02 www] #/etc/init. d/nfslock start

Starting NFS statd: [OK]

[Root @ real_server02 www] # chkconfig rpcbind on

[Root @ real_server02 www] # chkconfig nfs on

[Root @ real_server02 www] # chkconfig nfslock on

4. The shared directory set for our mustard is displayed.

[Root @ real_server02 www] # showmount-e localhost

Export list for localhost:

/Home/www 192.168.0 .*

3. Client settings

1. Start necessary services

[Root @ user ~] #/Etc/init. d/rpcbind start

Starting rpcbind: [OK]

[Root @ user ~] #/Etc/init. d/nfslock start

Starting NFS statd: [OK]

2. view the shared directory information provided by the NFS server.

[Root @ user ~] # Showmount-e 192.168.0.36

Export list for 192.168.0.36:

/Home/www 192.168.0 .*

3. Create a mount point and then mount the shared directory of the server

[Root @ user ~] # Mkdir/home/nfs/

[Root @ user ~] # Mount-t nfs 192.168.0.36:/home/www/home/nfs/

[Root @ user ~] # Df

Filesystem 1K-blocks Used Available Use % Mounted on

/Dev/sda2 18339256 2910612 14497060 17%/

Tmpfs 502204 84 502120 1%/dev/shm

/Dev/sda1 297485 34643 247482 13%/boot

192.168.0.36:/home/www 18208256 2918400 14358272 17%/home/nfs

We can see that we have succeeded !!!

Simple Application: Go to the directory we mounted on the client, create a test file, and check whether the file we created is displayed on the server.

NFS client

[Root @ user nfs] # ifconfig> test.txt

[Root @ user nfs] # cat test.txt

Eth0 Link encap: Ethernet HWaddr 00: 0C: 29: 97: 5D: 78

Inet addr: 192.168.0.39 Bcast: 192.168.0.255 Mask: 255.255.255.0

Inet6 addr: fe80: 20c: 29ff: fe97: 5d78/64 Scope: Link

Up broadcast running multicast mtu: 1500 Metric: 1

RX packets: 13460 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 6304 errors: 0 dropped: 0 overruns: 0 carrier: 0

Collisions: 0 FIG: 1000

RX bytes: 8998558 (8.5 MiB) TX bytes: 520939 (508.7 KiB)

I just intercepted some of them.

NFS server

[Root @ real_server02 www] # ls

Test.txt

[Root @ real_server02 www] # cat test.txt

Eth0 Link encap: Ethernet HWaddr 00: 0C: 29: 97: 5D: 78

Inet addr: 192.168.0.39 Bcast: 192.168.0.255 Mask: 255.255.255.0

Inet6 addr: fe80: 20c: 29ff: fe97: 5d78/64 Scope: Link

Up broadcast running multicast mtu: 1500 Metric: 1

RX packets: 13460 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 6304 errors: 0 dropped: 0 overruns: 0 carrier: 0

Collisions: 0 FIG: 1000

RX bytes: 8998558 (8.5 MiB) TX bytes: 520939 (508.7 KiB)

We can see that the synchronization is successful. Of course, the NFS server is not only used here!

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.