Article Title: Study Notes for setting up an NFS server in RHEL5.4. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Target: 1. Set up an NFS server
2. access through a client (Linux)
3. access through a Windows Client
4. Common commands
1. IP address description:
192.168.0.2 -- Host Name: nfs.wqmsl.com NFS server
192.168.0.3 -- Host Name: client.wqmsl.com client
2. Preparations
Change Host Name (three changes): 1. Change hostname, 2. Change hosts, 3./etc/sysconfig/network
I. achieve the first goal to build an NFS server
The required software packages are as follows:
650) this. width = 650; "height = 183>
Nfs-utils-1.0.9-24.el5-the main package for the nfs service, which provides the rpc. nfsd and rpc. mountd daemons and related instruction files.
Portmap-4.0-65.2.2.1 -- rpc main program that records the port ing information for the service.
650) this. width = 650; "height = 191>
Common NFS directories
1. the/etc/exports file is the main configuration file of NFS. By default, this file is stored in time and space and needs to be manually added.
2./usr/sbin/exportfs: This is a command to maintain NFS shared resources. Not many of them are used. We generally define them in the configuration file.
3. the/usr/sbin/showmount command is mainly used on the client to view the directory resources shared by NFS.
4./var/lib/nfs/etab (xtab) The etab records the complete permission settings for the directories shared by NFS, And the xtab is the other, record the client data that has been connected to this NFS host.
This configuration file can be divided into three columns
Column 1 ------ write the directory path you want to share
Column 2 ------ write the client description, that is, which clients can use your server
The third column ------ is next to the second column, and the content is shared permissions (rw ro sync)
650) this. width = 650; "height = 109>
650) this. width = 650; "height = 74>
650) this. width = 650; "height = 269>
I shared the/var and/etc directories,
1. NFS does not have strict requirements on client expressions. common expressions can be identified. For example, if an IP address is entered, the IP address ranges from 192.168.0.0/24 to 192.168.0.0/255.255.255.0.
Domain Name: www.wqmsl.com domain: * .wqmsl.com
2. If all IP addresses can be accessed, enter "*".
3. sync: synchronize data written to the memory and hard disk. async: the data will be saved to the memory instead of directly written to the hard disk.
4. Which of the two are better?
If you are an important small file, of course sync, synchronous writing, to avoid file loss
If you have large data volumes, we recommend that you do not write data synchronously.
5. rw: readable and writable
6. ro: Read-only. This is very simple.
Restart the nsf service because nfs is based on the portmap Process.
650) this. width = 650; "height = 198>
After OK, you can use the showmount command to check whether the sharing is successful.
Showmount-e is followed by your server IP Address
You can also use showmount-e. This is the default service to view your shared services, provided that the DNS can resolve itself, otherwise it is easy to report errors.
650) this. width = 650; "height = 131>
The nfs port is 2049, but it is based on portmap. The portmap port is 111.
Edit the NFS port configuration file
Vi/etc/sysconfig/nfs
650) this. width = 650; "height = 681>
Configure an nfs fixed port
Vim/etc/sysconfig/nfs
Customize the following ports, but cannot conflict with other ports
RQUOTAD_PORT = 5001
LOCKD_TCPPORT = 5002
LOCKD_UDPPORT = 5002
MOUNTD_PORT = 5003
STATD_PORT = 5004 is the five parameters
However, LOCKD_TCPPORT = LOCKD_UDPPORT = can use a port number.
You have defined it. Restart the server.
Start portmap and nfs services
Because the NFS service is based on the portmap service, we need to first start the portmap service: service portmap restart, and then the service nfs restart
Run the rpcinfo command to check whether nfs uses a fixed port.
Rpcinfo-p
650) this. width = 650; "height = 190>
I have not used a fixed port. The default port is 111 and 2049.
Checks the rpc registration status of nfs.
Rpcinfo-u host name or IP address Process
Rpcinfo-u 192.168.0.2 nfs
650) this. width = 650; "height = 69>
Query the server status
To ensure that the NFS server works properly, you need to run the portmap and nfs service programs in the system.
# Service portmap status
# Service nfs status
Start the server
# Service portmap start
# Service nfs start
Stop server running
# Service nfs stop
[1] [2] Next page