标签:
nfs-server与nfs-client端配置一样
2.6.32-431.el6.x86_64
nfs-utils-1.2.3-39.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
[
root@nfsclient /]# tail -6 /etc/yum.repos.d/CentOS-Media.repo #查看本地yum配置文件
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[
root@nfsclient /]# sed -i ‘s#enabled=0#enabled=1#gp‘ /etc/yum.repos.d/CentOS-Media.repo #修改配置文件
[
root@nfsclient /]# tail -6 /etc/yum.repos.d/CentOS-Media.repo # 检查是否修改成功
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Removed:
nfs-utils.x86_64 1:1.2.3-39.el6 rpcbind.x86_64 0:0.2.0-11.el6
Dependency Removed:
ipa-client.x86_64 0:3.0.0-37.el6 nfs-utils-lib.x86_64 0:1.1.5-6.el6
yp-tools.x86_64 0:2.9-12.el6 ypbind.x86_64 3:1.20.4-30.el6
Complete!
Installed:
nfs-utils.x86_64 1:1.2.3-70.el6_8.1 rpcbind.x86_64 0:0.2.0-12.el6
Dependency Installed:
nfs-utils-lib.x86_64 0:1.1.5-11.el6
python-argparse.noarch 0:1.2.1-2.1.el6
Dependency Updated:
libtirpc.x86_64 0:0.2.1-11.el6
Complete!
rpcbind-0.2.0-12.el6.x86_64
nfs-utils-1.2.3-70.el6_8.1.x86_64
nfs-client端配置(安装时两边都用同一种方法,保持一致不容易出错)
Failed to set locale, defaulting to C
NFS file server
Installed:
nfs-utils.x86_64 1:1.2.3-70.el6_8.1
Dependency Installed:
nfs-utils-lib.x86_64 0:1.1.5-11.el6
python-argparse.noarch 0:1.2.1-2.1.el6
rpcbind.x86_64 0:0.2.0-12.el6
Updated:
nfs4-acl-tools.x86_64 0:0.3.3-8.el6
Dependency Updated:
libtirpc.x86_64 0:0.2.1-11.el6
Complete!
rpcbind-0.2.0-12.el6.x86_64
nfs-utils-1.2.3-70.el6_8.1.x86_64
nfs-server端配置
Starting rpcbind: [ OK ]
rpc 5212 1 0 15:04 ? 00:00:00 rpcbind
root 5221 4567 0 15:05 pts/0 00:00:00 grep rpcbind
rpcbind (pid 5212) is running...
Stopping rpcbind: [ OK ]
rpcinfo: can‘t contact portmapper: RPC: Remote system error - Connection refused
报错原因rpcbind服务未启动
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
正在启动 RPC idmapd: [确定]
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100011 1 udp 875 rquotad
100011 2 udp 875 rquotad
100011 1 tcp 875 rquotad
100011 2 tcp 875 rquotad
100005 1 udp 37917 mountd
100005 1 tcp 38242 mountd
100005 2 udp 40271 mountd
100005 2 tcp 50999 mountd
100005 3 udp 48150 mountd
100005 3 tcp 47540 mountd
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 38739 nlockmgr
100021 3 udp 38739 nlockmgr
100021 4 udp 38739 nlockmgr
100021 1 tcp 44041 nlockmgr
100021 3 tcp 44041 nlockmgr
100021 4 tcp 44041 nlockmgr
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs-client配置
Starting rpcbind: [ OK ]
rpcbind (pid 25927) is running...
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs-server端配置
#shared data for bbs by oldboy at 20160810
/data 192.168.161.0/24(rw,sync)
Export list for localhost:
/data 192.168.161.0/24
nfs-client端配置
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
clnt_create:RPC:端口映射器失败——不能接受:errno 113(没有通往主机)
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
Export list for 192.168.161.133:
/data 192.168.161.0/24
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 4.0G 12G 27% /
tmpfs 495M 80K 495M 1% /dev/shm
/dev/sda1 2.0G 59M 1.8G 4% /boot
/dev/sr0 4.2G 4.2G 0 100% /media/CentOS_6.5_Final
/dev/sr0 4.2G 4.2G 0 100% /media/cdrom
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 4.0G 12G 27% /
tmpfs 495M 80K 495M 1% /dev/shm
/dev/sda1 2.0G 59M 1.8G 4% /boot
/dev/sr0 4.2G 4.2G 0 100% /media/CentOS_6.5_Final
/dev/sr0 4.2G 4.2G 0 100% /media/cdrom
192.168.161.133:/data 16G 3.9G 12G 26% /mnt #挂载成功
total 0
-rw-r--r--. 1 root root 0 Aug 10 15:49 11
-rw-r--r--. 1 root root 0 Aug 10 15:49 22
-rw-r--r--. 1 root root 0 Aug 10 15:49 33
touch: cannot touch `test.log‘: Permission denied 拒绝访问
到nfs-server端检查
drwxr-xr-x 2 root root 4096 Aug 10 15:49 /data
/data 192.168.161.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
[
root@nfsserver /]# chown -R nfsnobody.nfsnobody /data #给nsfnobody赋予权限
total 0
-rw-r--r--. 1 nfsnobody nfsnobody 0 Aug 10 15:49 11
-rw-r--r--. 1 nfsnobody nfsnobody 0 Aug 10 15:49 22
-rw-r--r--. 1 nfsnobody nfsnobody 0 Aug 10 15:49 33
-rw-r--r--. 1 nfsnobody nfsnobody 0 Aug 10 16:02 test.log #创建成功
开机自动挂载 修改/etc/fstab文件
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Shutting down RPC idmapd: [确定]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
正在启动 RPC idmapd: [确定]
从上面NFS服务启动过程的提示,可以看护运行NFS服务默认需要启动的服务或进程至少有:NFS quotas(rpc.rquotad)、NFS daemon(nfsd)、NFS mountd(rpc.mountd)。可以通过如下命令查看启动NFS后,系统中运行的NFS相关进程:
rpc 3631 1 0 21:29 ? 00:00:00 rpcbind rpc服务
root 3688 2 0 21:31 ? 00:00:00 [rpciod/0]
root 3824 1 0 21:32 ? 00:00:00 rpc.rquotad 磁盘配额进程
root 3828 1 0 21:32 ? 00:00:00 rpc.mountd 权限管理进程
root 3834 2 0 21:32 ? 00:00:00 [nfsd4]
root 3835 2 0 21:32 ? 00:00:00 [nfsd4_callbacks]
root 3836 2 0 21:32 ? 00:00:00 [nfsd]
root 3837 2 0 21:32 ? 00:00:00 [nfsd]
root 3838 2 0 21:32 ? 00:00:00 [nfsd]
root 3839 2 0 21:32 ? 00:00:00 [nfsd] NFS主进程
root 3840 2 0 21:32 ? 00:00:00 [nfsd]
root 3841 2 0 21:32 ? 00:00:00 [nfsd]
root 3842 2 0 21:32 ? 00:00:00 [nfsd]
root 3843 2 0 21:32 ? 00:00:00 [nfsd]
root 3869 1 0 21:32 ? 00:00:00 rpc.idmapd
root 4039 3260 0 21:43 pts/1 00:00:00 grep -E rpc|nfs
以上的进程查看均可以执行“man 进程名”来查看进程的功能细节
以上的进程查看均可以执行“man 进程名”来查看进程的功能细节CentOS-6.5-NFS部署
标签:
原文地址:http://www.cnblogs.com/zzzhfo/p/5797187.html