centos 6.0 安装配置nfs与排错

NFS的安装配置:
centos 5 :
yum install nfs-utils portmap
centos 6 :

yum install nfs-utils rpcbind

chkconfig nfs on

chkconfig nfs on

rpcinfo -p 如果报错

如下解决:


showmount -e localhost     报错:

解决


创建一个用户并且配置NFS 共享他的主目录,共享给example.com 读写权限:
useradd nfstest
vim /etc/exports
……
应该有类似一下的行
/home/nfstest *.example.com(ro,sync)
开启nfs 服务和nsflock 服务:
 service nfs start
 service nfslock start
观察哪个RPC 服务正在运行,查看是否在导出的/home/nfstest 目录中:
rpcinfo -p
showmount -e localhost
再找一台工作站,挂载彼此的共享。尝试用root 和nfstest 向读取共享中的内容,
并在其中写如内容:
mkdir /home/remote
mount desktopY:/home/nfstest /home/remote
注意:如果nfstest 用户的UID 和GID 与你使用的工作站匹配,就应该能看到NFS 共享
的读写权限。若不匹配,就不能访问目录。因为设置了默认的root_squash 选项,所以root
用户应该不能访问NFS 共享。


以下是详细讲解文章:

NFS的安装配置:
centos 5 :
yum install nfs-utils portmap
centos 6 :
yum install nfs-utils rpcbind


本节是使用centos 6的配置过程:
设备:两台 centos6 OS 安装的时候选择的是"Basic Server"软件配置包。
首先,让两台机器都安装NFS的 软件包,如下显示的是服务器端:


###(建立挂载的目录,并且挂载目录。)
[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)
### 备注:/opt/centos6表示nfs共享的目录 192.168.1.0-192.168.1.254区间的IP可以访问,访问权限是自读,root 用户
###(启动对应的服务)
 chkconfig nfs on
/etc/init.d/rpcbind start
/etc/init.d/nfs start


service iptables stop


客户端:
[root@roothomes /home]$ yum install nfs-utils rpcbind
安装完毕!
[root@vmBS00 ~]# service iptables stop


###查看是否能访问nfs服务
[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
###配置开机自动挂载
[root@vmBS00 ~]# vi /etc/fstab
### 添加 #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
root@192.168.1.116's password:
Last login: Mon Mar  5 17:29:04 2012 from 192.168.1.23
[root@vmBS00 ~]# ls /opt/centos6/
thisISnfsFile
[root@vmBS00 ~]#



rehat 安装....................

Red Hat Enterprise Linux 6.0 可运行系统,并且是成功验证系统。
实验目标:
掌握nfs 的使用方法,建立网络共享。
实验背景:
公司组建了一个小型局域网,这个局域网中的用户都是用linux 的操作系统。现在公司
想让这个局域网中的工作站实现网络共享,这时候你需要使用NFS 来实现网络共享的功
能。
实验要求:
1、安装nfs 服务
2、创建nfs 共享目录
实验详解:
1、以root 用户的身份登录系统。如果你使用的是图形化环境, 点击[应用程序
(Applications)]->[附件(System Tools)]->[终端(Terminal)]来打开终端:
2、安装nfs 的软件包:
[root@desktopX ~]# yum-y install nfs-utils
注意:nfs-utils 软件包提供了nfs 和nslookup 服务。
3、设置nfs 开机自动运行:
[root@desktopX ~]# chkconfig nfs on
[root@desktopX ~]# chkconfig nfslock on
4、查看RPC 服务是否正常运行:
[root@desktopX ~]# rpcinfo -p
[root@desktopX ~]# showmount -e localhost
5、创建一个用户并且配置NFS 共享他的主目录,共享给example.com 读写权限:
[root@desktopX ~]# useradd nfstest
[root@desktopX ~]# vim /etc/exports
……
应该有类似一下的行
/home/nfstest *.example.com(ro,sync)
6、开启nfs 服务和nsflock 服务:
[root@desktopX ~]# service nfs start
[root@desktopX ~]# service nfslock start
7、观察哪个RPC 服务正在运行,查看是否在导出的/home/nfstest 目录中:
[root@desktopX ~]# rpcinfo -p
[root@desktopX ~]# showmount -e localhost
8、再找一台工作站,挂载彼此的共享。尝试用root 和nfstest 向读取共享中的内容,
并在其中写如内容:
[root@desktopX ~]# mkdir /home/remote
[root@desktopX ~]# mount desktopY:/home/nfstest /home/remote
注意:如果nfstest 用户的UID 和GID 与你使用的工作站匹配,就应该能看到NFS 共享
的读写权限。若不匹配,就不能访问目录。因为设置了默认的root_squash 选项,所以root
用户应该不能访问NFS 共享。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值