CentOS 6 NFS installation configuration


There are the following commands to view the CentOS version method  :

# lsb_release -a

exports file:
/data/tomcat-/webapps/ROOT 10.0.0.1/8(insecure,rw,sync)
/data/tomcat-/webapps/ROOT 10.0.0.1 /8 (insecure, rw, sync)


commonly used
/etc/init.d/nfs start
/etc/init.d/nfs stop
/etc/init.d/nfs reload
service nfs status
exportfs -r
mount
umount path






http:// blog.chinaunix.net/uid-26284318-id-3111651.html

NFS installation configuration:
centos 5 :
yum install nfs-utils portmap
centos 6 :
yum install nfs-utils rpcbind


This section is the configuration process using centos 6:
Device: The "Basic Server" software configuration package was selected when the two centos6 OS were installed.
First, let both machines install the NFS package, as shown below is the server side:
[root@roothomes /home]$ yum install nfs-utils rpcbind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Setting up Install Process
Package rpcbind-0.2.0-8.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.2.3-15.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package            Arch            Version                 Repository     Size
================================================================================
Updating:
nfs-utils          x86_64          1:1.2.3-15.el6          base          308 k

Transaction Summary
================================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 308 k
Is this ok [y/N]: y
Downloading Packages:
nfs-utils-1.2.3-15.el6.x86_64.rpm                        | 308 kB     00:10
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
base/gpgkey                                              | 3.3 kB     00:00 ...
Importing GPG key 0xC105B9DE "CentOS-6 Key (CentOS 6 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating : 1:nfs-utils-1.2.3-15.el6.x86_64 1/2
  Cleanup : 1:nfs-utils-1.2.2-7.el6.x86_64 2/2

Updated:
  nfs- utils.x86_64 1:1.2.3-15.el6

Complete!
[root@roothomes /home]$

server side:
###(Create a mounted directory and mount the directory.)
[root@roothomes /etc]$ mkdir /opt/centos6
[root@roothomes /etc]$ cd /opt/centos6/
[root@roothomes /opt/centos6]$ mkdir thisISnfsFile
[root@roothomes /opt/centos6]$ ls
thisISnfsFile
[root@roothomes /etc]$ vi /etc/exports
[root@roothomes /opt/centos6]$ cat /etc /exports

/opt/centos6 192.168.1.0/24(ro,no_root_squash)
### Note: /opt/centos6 indicates that the IP in the range 192.168.1.0-192.168.1.254 shared by nfs can be accessed, and the access permission is self-reading, root User
### (start the corresponding service)
[root@roothomes /opt/centos6]$ chkconfig nfs on
[root@roothomes /opt/centos6]$ /etc/init.d/rpcbind start
[root@roothomes /opt/centos6 ]$ /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@roothomes /opt/centos6]$ service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]


客户端:
[root@roothomes /home]$ yum install nfs-utils rpcbind
安装完毕!
[root@vmBS00 ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules: [ OK ]
###Check if nfs service can be accessed
[root@vmBS00 ~]# showmount -e 192.168.1.75
Export list for 192.168.1.75:
/opt/centos6 192.168.1.0/24
[root@vmBS00 ~]# mkdir /opt/centos6
[root@vmBS00 ~]# mount -t nfs 192.168.1.75:/opt/centos6/ /opt/centos6/
[root@vmBS00 ~]# ls /opt/centos6/
thisISnfsFile
### Configure automatic mount at boot
[root@vmBS00 ~]# vi /etc/fstab
### Add #192.168.1.75:/opt/centos6/ /opt/centos6/ nfs nodev,ro,rsize=32768,wsize=32768 0 0

[root@vmBS00 ~]# init 6
[root@vmBS00 ~]#
login as: root
[email protected]'s password:
Last login: Mon Mar 5 17:29:04 2012 from 192.168.1.23
[root@vmBS00 ~]# ls /opt/centos6/
thisISnfsFile
[root@vmBS00 ~]#

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326915561&siteId=291194637