Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1660547
  • 博文数量: 391
  • 博客积分: 8464
  • 博客等级: 中将
  • 技术积分: 4589
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-13 15:12
个人简介

狮子的雄心,骆驼的耐力,孩子的执著!

文章分类

全部博文(391)

文章存档

2023年(4)

2018年(9)

2017年(13)

2016年(18)

2014年(7)

2013年(29)

2012年(61)

2011年(49)

2010年(84)

2009年(95)

2008年(22)

分类: LINUX

2012-03-29 09:11:03

提示原来在rhel5或者centos5中的portmap服务在rhel6或者centos6中已经变更为rpcbind
,并且在rhel6或者centos6中,默认的版本是nfs4。

【1】在系统上建立NFS服务端的配置
[root@localhost ~]# yum -y install nfs-utils # install
 
[root@localhost ~]# vi /etc/idmapd.conf
# 行 5: 替换成你实际的域名信息
 Domain = local.domain
 
[root@localhost ~]# vi /etc/exports
# 按照下面的提示编辑文件内容
/home 10.0.0.0/24(rw,sync,no_root_squash,no_all_squash)
# *提示
/home ⇒ 输出的共享目录路径
 10.0.0.0/24 ⇒ 列出允许给予访问权限的网络范围
 rw ⇒ 写权限
 sync ⇒ 目录内文件同步
 no_root_squash ⇒ 客户端可以有root身份写入特权,不映射为nfsnobody用户
 no_all_squash ⇒ 保留共享文件的UID和GID
[root@localhost ~]# /etc/rc.d/init.d/rpcbind start
Starting rpcbind: [  OK  ]

[root@localhost ~]# /etc/rc.d/init.d/nfslock start
Starting NFS statd: [  OK  ]

[root@localhost ~]# /etc/rc.d/init.d/nfs start
RPC: Registered udp transport module.
 RPC: Registered tcp transport module.
 RPC: Registered tcp NFSv4.1 backchannel transport module.
 Installing knfsd (copyright (C) 1996 ).
 Starting NFS services: [  OK  ]

 Starting NFS daemon: NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
 NFSD: starting 90-second grace period [ OK ]
 
Starting NFS mountd: [ OK ][  OK  ]

 Starting RPC idmapd: [ OK ][  OK  ]
[root@localhost ~]# chkconfig rpcbind on
[root@localhost ~]# chkconfig nfslock on
[root@localhost ~]# chkconfig nfs on
[root@localhost ~]# vi /etc/sysconfig/iptables
#在文件的倒数第3行上面,添加一行如下的内容,开放nfs服务端的连接端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
[root@localhost ~]# service iptables restart
#更新nfs服务端系统上的iptables防火墙策略

【2】NFS客户端配置

[root@www ~]# yum -y install nfs-utils # install
 
[root@www ~]# vi /etc/idmapd.conf
# 行 5: 替换成你实际的域名信息
 Domain = local.domain
[root@www ~]# /etc/rc.d/init.d/rpcbind start
Starting rpcbind: [  OK  ]

[root@www ~]# /etc/rc.d/init.d/rpcidmapd start

Starting RPC idmapd: RPC: Registered udp transport module.
 RPC: Registered tcp transport module.
 RPC: Registered tcp NFSv4.1 backchannel transport module. [ OK ]
 [root@www ~]# /etc/rc.d/init.d/nfslock start
Starting NFS statd: [  OK  ]
[root@www ~]# /etc/rc.d/init.d/netfs start
Mounting other filesystems: [  OK  ]
[root@www ~]# chkconfig rpcbind on
[root@www ~]# chkconfig rpcidmapd on
[root@www ~]# chkconfig nfslock on
[root@www ~]# chkconfig netfs on
[root@www ~]# mount -t nfs nfs.server:/home /home
[root@www ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/vda3              19G  4.3G   13G  25% /
tmpfs                 1.5G     0  1.5G   0% /dev/shm
/dev/vda1             194M   27M  158M  15% /boot
nfs.server:/home      18G    30M  17G   5%  /home
# 已经加载了NFS服务端的/home目录到本地系统

[root@www ~]# /etc/fstab
# 在文件末尾添加如下内容: 替换在NFS服务端的/home目录路径为你实际输出的目录路径
nfs.server:/home /home nfs defaults 1 1

参考:

阅读(1215) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~