linux的nfs配置
1. 在linux下怎样配置NFS(网络文件系统的配置和实现文件共享)
方法/步骤
首先确认自己的服务器上面是否有portmap和nfs包,一般情况下都会有.
查询命令:
rpm
-qa
|
grep
portmap
rpm
-qa
|
grep
nfs
如果有就接着向下走
启动portmap和nfs,但是portmap的先于nfs启动,因为portmap为nfs动态分配端口
查看是有启动正常用如下命令
prcinfo
-p
如果看到portmap和nfs表示启动正常
设置你要共享的文件和目录
编辑vi
/etc/exports
格式如下:
共享目录
允许访问的主机ip(权限)
输出共享目录和文件
1.要不重启nfs服务
2.使用exportfs
-rv命令
接着到另一台服务器上面去挂载nfs服务器输出的文件和目录
1.新建你要挂载的目录
2.查看nfs服务器的输出目录
showmount
-e
nfs的ip
挂载目录或文件
格式如下:
mount
nfs服务器地址:/usr/local/web
/mnt/websites
查看挂载结果
df
-h
测试共享时候成功,在web1上面下面的挂载目录下面新建一个文件然后随便写点东西看web2上面时候同步
卸载目录的命令:
umount
/mnt/websites
2. 如何在linux操作系统中配置NFS服务器
1.
服务端安装:
1.setup
2.System
Services
3.分别选中portmap与nfs
4.service
portmap
restart
5.service
nfs
restart
权限文件配置示例:
1.vi
/etc/exports
2.写入/usr/www/
192.168.153.133(rw,no_root_squash,sync)
/usr/local/www指本地路径
192.168.153.133远程IP
(rw,no_root_squash,sync)读写并权限过渡
3.service
nfs
restart
3. linux nfs 配置问题,急!!!!
“没有到主机的路由”,看明白没?路由啊、路由,所谓路由,就是由A机到B机的网络途径,你ping能通不?看配置是没错,不过你要保证两台机器能通讯呀,貌似客户机找不到服务器哦
补充回答:
能ping到对方么?基本的ifconfig你应该会用吧,涉及到的配置文件有/etc/sysconfig/network/config/*
/etc/hosts
/etc/resolv.conf
/etc/networks
/etc/nsswitch.conf
对等网络的客户机用服务器的IP做网关,如果你经过了一台路由器,在路由器上设置静态路由
补充回答:
你们是通过了一台路由器?去路由器设置静态路由,实在不行,直接用交叉线对等连接两台机器测试NFS是否工作。如果能工作,问题还是出在路由器上
OK,你把共享的文件路径上所有的文件夹other位上都加上读和运行位试试。命令是
chmod -R 755 /nfsroot/pmp-root
4. 在linux下配置NFS服务器,设置可以被挂载的目录为:/nfsboot
NFS(网络文件系统)服务可以将远程Linux系统上的文件共享资源挂载到本地主机的目录上,从而使得本地主机(Linux客户端)基于TCP/IP协议,像使用本地主机上的资源那样读写远程Linux系统上的共享文件。配置NFS服务
5. 如何配置linux内核具有nfs的功能
1、使用的技术
NFS
2、测试环境
NFS服务器:192.168.255.18
NFS客户端:192.168.255.11
操作系统:REDHAT4
3、NFS服务器配置
(1)配置 /etc/hosts.deny
禁止任何客户端能和你的NFS服务器进行NFS连接:
### NFS DAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
(2)配置/etc/hosts.allow
允许那些你想要的客户端和你的NFS服务器建立连接。下列步骤将允许任何IP地址
以192.168.2开头的主机(连接到NFS服务器上),也可以指定特定的IP地址。
### NFS DAEMONS
portmap: 192.168.255.
lockd: 192.168.255.
rquotad: 192.168.255.
mountd: 192.168.255.
statd: 192.168.255.
(3)重启portmap
运行 $ /etc/init.d/portmap restart 重启portmap daemon。
(4)配置/etc/exports
NFS挂载目录及权限由/etc/exports文件定义。比如要将我的/tmp目录让
192.168.255.*的IP共享, 则在该文件末尾添加下列语句:
/tmp 192.168.255.*(rw,sync,no_root_squash)
192.168.255.* 网段内的NFS客户端能够共享NFS服务器/tmp目录内容,且有读,写
权限,并且该用户进入/home/zp/share目录后的身份为root,最好加上sync,否则
$ sudo exportfs -r 时会给出警告, sync是NFS的默认选项。
(5)重启NFS服务
运行 $ /etc/init.d/nfs-kernel-server restart 重启nfs服务)
(6)NFS服务器查看共享是否成功
$ Showmount –e 192.168.255.18
/tmp 192.168.255.*
(6)NFS客户端启动NFS服务
service nfs start
(7)NFS客户端查看服务器共享目录
Showmount –e 192.168.255.18
(8)挂载NFS服务器共享目录
mount –t nfs -o tcp192.168.255.18:/tmp /tmp
4、错误排查
当/etc/exports设置的权限,不符合client端的来源时,则会出现以下错误信息:
mount: hostname:/dir failed, reason given by server: Permission denied
6. LINUX怎样安装和使用NFS服务
举例,有台机器叫AAA,想把自己机器根下的一个叫abc的目录极其里面的所有文件都共享给一台叫BBB的机器。
在这里AAA就可看成是服务器,BBB为客户端,方法如下:
(在AAA上先配置)
1.
vi /etc/exports
(用vi编辑器打开共享资源,在里面填写共享的属性,linux下nfs的共享资源路径为etc下的exports)
打开编辑器后,里面可能什么都没有,需要自己填写,然后保存即可,在这里填写
2.
/abc BBB(ro)
之后按Esc停止文字录入,然后按Shift+;键,在出来的冒号后输入wq,表示保存退出!
(这个的格式是这样的:先给出要共享的路径,然后空格,后面写共享给谁,可以是IP地址或主机名。再后面的括号里表示以什么方式来共享,ro是客户端只能读,如果想让客户端可以改,可设为rw,即可读写)
7. 如何使用NFS配置linux文件共享
1、使用的技术
NFS
2、测试环境
NFS服务器:192.168.255.18
NFS客户端:192.168.255.11
操作系统:REDHAT4
3、NFS服务器配置
(1)配置 /etc/hosts.deny
禁止任何客户端能和你的NFS服务器进行NFS连接:
### NFS DAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
(2)配置/etc/hosts.allow
允许那些你想要的客户端和你的NFS服务器建立连接。下列步骤将允许任何IP地址
以192.168.2开头的主机(连接到NFS服务器上),也可以指定特定的IP地址。
### NFS DAEMONS
portmap: 192.168.255.
lockd: 192.168.255.
rquotad: 192.168.255.
mountd: 192.168.255.
statd: 192.168.255.
(3)重启portmap
运行 $ /etc/init.d/portmap restart 重启portmap daemon。
(4)配置/etc/exports
NFS挂载目录及权限由/etc/exports文件定义。比如要将我的/tmp目录让
192.168.255.*的IP共享, 则在该文件末尾添加下列语句:
/tmp 192.168.255.*(rw,sync,no_root_squash)
192.168.255.* 网段内的NFS客户端能够共享NFS服务器/tmp目录内容,且有读,写
权限,并且该用户进入/home/zp/share目录后的身份为root,最好加上sync,否则
$ sudo exportfs -r 时会给出警告, sync是NFS的默认选项。
(5)重启NFS服务
运行 $ /etc/init.d/nfs-kernel-server restart 重启nfs服务)
(6)NFS服务器查看共享是否成功
$ Showmount –e 192.168.255.18
/tmp 192.168.255.*
(6)NFS客户端启动NFS服务
service nfs start
(7)NFS客户端查看服务器共享目录
Showmount –e 192.168.255.18
(8)挂载NFS服务器共享目录
mount –t nfs -o tcp192.168.255.18:/tmp /tmp
4、错误排查
当/etc/exports设置的权限,不符合client端的来源时,则会出现以下错误信息:
mount: hostname:/dir failed, reason given by server: Permission denied
5、NFS的一些参数
下面是一些NFS共享的常用参数(/etc/exports配置):
ro
只读访问
rw
读写访问
sync
所有数据在请求时写入共享
async
NFS在写入数据前可以相应请求
secure
NFS通过1024以下的安全TCP/IP端口发送
insecure
NFS通过1024以上的端口发送
wdelay
如果多个用户要写入NFS目录,则归组写入(默认)
no_wdelay
如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
hide
在NFS共享目录中不共享其子目录
no_hide
共享NFS目录的子目录
subtree_check
如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
no_subtree_check
和上面相对,不检查父目录权限
all_squash
共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
no_all_squash
保留共享文件的UID和GID(默认)
root_squash
root用户的所有请求映射成如anonymous用户一样的权限(默认)
no_root_squash
root用户具有根目录的完全管理访问权限
anonuid=xxx
指定NFS服务器/etc/passwd文件中匿名用户的UID
anongid=xxx
指定NFS服务器/etc/passwd文件中匿名用户的GID
注意:如果按照上面步骤不能成功,请查看两台机器的防火墙设置。在条件允许的
情况下,建议将防火墙关闭!
8. vmware安装linux时nfs如何配置
1、使用的技术
nfs
2、测试环境
nfs服务器:192.168.255.18
nfs客户端:192.168.255.11
操作系统:redhat4
3、nfs服务器配置
(1)配置
/etc/hosts.deny
禁止任何客户端能和你的nfs服务器进行nfs连接:
###
nfs
daemons
portmap:all
lockd:all
mountd:all
rquotad:all
statd:all
(2)配置/etc/hosts.allow
允许那些你想要的客户端和你的nfs服务器建立连接。下列步骤将允许任何ip地址
以192.168.2开头的主机(连接到nfs服务器上),也可以指定特定的ip地址。
###
nfs
daemons
portmap:
192.168.255.
lockd:
192.168.255.
rquotad:
192.168.255.
mountd:
192.168.255.
statd:
192.168.255.
(3)重启portmap
9. NFS笔记(二)NFS服务器配置实例
一、NFS服务器配置实例
实验拓扑
二、实验要求及环境
2.1实验环境
NFS服务器 IP:192.168.8.5
环境:
[root@server7 ~]# uname -a
Linux server7.ctos.zu 3.10.0-514.el7.centos.plus.i686 #1 SMP Wed Jan 25 12:55:04 UTC 2017 i686 i686 i386 GNU/Linux
[root@server7 ~]# cat /etc/redhat-release
CentOS release 7.3.1611 (AltArch)
客户端IP:192.168.8.7
环境:
[root@client-A ~]# uname -a
Linux client-A.ctos.zu 2.6.32-696.el6.i686 #1 SMP Tue Mar 21 18:53:30 UTC 2017 i686 i686 i386 GNU/Linux
[root@client-A ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
2.2、实验要求
NFS服务器
1、/home/share 目录可读写,并且不限制用户身份,共享给192.168.8.0/24网段不的所有主机;
2、/home/data 这个目录仅共享给192.168.8.7这台主机,以供该主机上面的这个用户来使用,
也就是说在192.168.8.5和192.168.8.7上均有账号,且账号均为;
3、/home/upload 这个目录做为192.168.8.0/24网段的数据上传目录,其中/home/upload
的用户和所属组为nfs-upload这个名字,它的UID和GID均为222;
4、/home/nfs 这个目录的属性为只读,可提供除了网段内的工作站外,向Internet也提供数据内容。
三、服务器端设置
1、 编辑/etc/exports内容
[root@server7 etc]# cat /etc/exports
/home/share 192.168.8.0/24(rw,no_root_squash)
/home/data 192.168.8.7(rw)
/home/upload 192.168.8.0/24(rw,all_squash,anonuid=222,anongid=222)
/home/nfs 192.168.8.0/24(ro) *(ro,all_squash)
2、按要求建立每个对应目录
2.1、创建/home/share目录 任何人都可以在 /home/share内新增、修改文件,但
仅有该文件/目录的建立者与root能够删除自己的目录或文件。
[root@server7 etc]# mkdir -p /home/share
[root@server7 etc]# ll -d /home/share/
drwxr-xr-x. 2 root root 6 9月 5 15:50 /home/share/
[root@server7 etc]# chmod 1777 /home/share/
[root@server7 etc]# ll -d /home/share/
drwxrwxrwt. 2 root root 6 9月 5 15:50 /home/share/
2.2、创建/home/nfs
[root@server7 etc]# ll -d /home/nfs/
drwxr-xr-x. 2 root root 6 9月 5 16:52 /home/nfs/
2.3、创建/home/data目录
[root@server7 etc]# mkdir -v /home/data
mkdir: 已创建目录 "/home/data"
[root@server7 etc]# ll -d /home/data/
drwxr-xr-x. 2 root root 6 9月 5 16:57 /home/data/
[root@server7 etc]# useradd
root@server7 etc]# passwd
更改用户 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@server7 etc]# cat /etc/passwd | grep
:x:1000:1000::/home/:/bin/bash
[root@server7 etc]# chmod 700 /home/data/
[root@server7 etc]# chown -R : /home/data/
[root@server7 etc]# ll -d /home/data/
drwx------. 2 6 9月 5 16:57 /home/data/
2.4、创建/home/upload目录
#先建立对应账号与组名及UID
[root@server7 etc]# groupadd -g 222 nfs-upload
[root@server7 etc]# useradd -g 222 -u 222 -M nfs-upload
[root@server7 etc]# cat /etc/passwd|grep nfs
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
nfs-upload:x:222:222::/home/nfs-upload:/bin/bash
#创建目录,修改属主
[root@server7 etc]# mkdir /home/upload
[root@server7 etc]# chown -R nfs-upload:nfs-upload /home/upload/
[root@server7 etc]# ll -d /home/upload/
drwxr-xr-x. 2 nfs-upload nfs-upload 6 9月 6 08:38 /home/upload/
2.5、重启NFS服务
[root@server7 etc]# systemctl restart nfs
[root@server7 etc]# systemctl status nfs
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (exited) since 三 2017-09-06 08:41:40 CST; 8s ago
Process: 9171 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
Process: 9169 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
Process: 9168 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
Process: 9181 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 9180 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 9181 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/nfs-server.service
9月 06 08:41:40 server7.ctos.zu systemd[1]: Starting NFS server and services...
9月 06 08:41:40 server7.ctos.zu systemd[1]: Started NFS server and services.
[root@server7 etc]# tail /var/log/messages
Sep 6 08:41:40 server7 systemd: Started NFS Mount Daemon.
Sep 6 08:41:40 server7 rpc.mountd[9178]: Version 1.3.0 starting
Sep 6 08:41:40 server7 systemd: Started NFSv4 ID-name mapping service.
Sep 6 08:41:40 server7 systemd: Starting NFS server and services...
Sep 6 08:41:40 server7 kernel: NFSD: starting 90-second grace period (net c0c932c0)
Sep 6 08:41:40 server7 systemd: Started NFS server and services.
Sep 6 08:41:40 server7 systemd: Starting Notify NFS peers of a restart...
Sep 6 08:41:40 server7 sm-notify[9198]: Version 1.3.0 starting
Sep 6 08:41:40 server7 sm-notify[9198]: Already notifying clients; Exiting!
Sep 6 08:41:40 server7 systemd: Started Notify NFS peers of a restart.
2.6、查看NFS服务器共享出来目录
2.7、关闭防火墙、selinux
2.8查看配置
[root@server7 ~]# exportfs -v
/home/data 192.168.8.7(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
/home/share 192.168.8.0/24(rw,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)
/home/upload 192.168.8.0/24(rw,wdelay,root_squash,all_squash,no_subtree_check,anonuid=222,anongid=222,sec=sys,rw,secure,root_squash,all_squash)
/home/nfs 192.168.8.0/24(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
/home/nfs <world>(ro,wdelay,root_squash,all_squash,no_subtree_check,sec=sys,ro,secure,root_squash,all_squash)
四、客户端配置
4.1、客户端也要安装nfs-utils和rcpbind软件包
[root@client-A ~]# yum install nfs-utils rpcbind -y
4.2、启动RPC
[root@client-A ~]# service rpcbind start /systemctl start rpcbind
Starting rpcbind: [ OK ]
[root@client-A ~]# service rpcbind status
rpcbind (pid 1926) is running...
[root@client-A ~]# chkconfig --list |grep rpcbind
4.3、客户端关闭防火墙、selinux
[root@client-A ~]# service iptables stop /systemctl stop firewalld
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading moles: [ OK ]
4.4测试网络
[root@client-A ~]# ping 192.168.8.5
PING 192.168.8.5 (192.168.8.5) 56(84) bytes of data.
64 bytes from 192.168.8.5: icmp_seq=1 ttl=64 time=2.16 ms
64 bytes from 192.168.8.5: icmp_seq=2 ttl=64 time=0.697 ms
64 bytes from 192.168.8.5: icmp_seq=3 ttl=64 time=0.346 ms
64 bytes from 192.168.8.5: icmp_seq=4 ttl=64 time=0.336 ms
64 bytes from 192.168.8.5: icmp_seq=5 ttl=64 time=0.335 ms
64 bytes from 192.168.8.5: icmp_seq=6 ttl=64 time=0.317 ms
64 bytes from 192.168.8.5: icmp_seq=7 ttl=64 time=0.512 ms
64 bytes from 192.168.8.5: icmp_seq=8 ttl=64 time=0.320 ms
^C
--- 192.168.8.5 ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7555ms
rtt min/avg/max/mdev = 0.317/0.629/2.169/0.595 ms
4.5 在客户端查看NFS服务器共享出来目录
[root@client-A ~]# showmount -e 192.168.8.5
Export list for 192.168.8.5:
/home/nfs (everyone)
/home/upload 192.168.8.0/24
/home/share 192.168.8.0/24
/home/data 192.168.8.7
4.6、挂载NFS服务器上/home/nfs目录到本地/opt/data目录下
#临时挂载
#永久挂载
编辑、/etc/fstab文件,新增如下条目:
192.168.8.5:/home/nfs /opt/data/ nfs4 defaults 0 0
更多信息参考 nfs参数详解
#查看信息
[root@client-A data] # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
6.5G 644M 5.6G 11% /
tmpfs 250M 0 250M 0% /dev/shm
/dev/sda1 477M 26M 426M 6% /boot
192.168.8.5:/home/nfs
8.0G 1.6G 6.5G 20% /opt/data
[root@client-A data]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
192.168.8.5:/home/nfs on /opt/data type nfs (rw,vers=4,addr=192.168.8.5,clientaddr=192.168.8.7)
#创建文件测试
[root@client-A data]# touch testabc
touch: cannot touch `testabc': Read-only file system
4.7挂载/home/upload 目录到客户端/opt/upload目录下
#挂载
[root@client-A data]# mkdir /opt/upload
[root@client-A data]# mount -t nfs 192.168.8.5:/home/upload /opt/upload/
#查看挂载是否成功
[root@client-A data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
6.5G 644M 5.6G 11% /
tmpfs 250M 0 250M 0% /dev/shm
/dev/sda1 477M 26M 426M 6% /boot
192.168.8.5:/home/nfs
8.0G 1.6G 6.5G 20% /opt/data
192.168.8.5:/home/upload
8.0G 1.6G 6.5G 20% /opt/upload
#客户端创建nfs-upload用户
[root@client-A ~]# groupadd -g 222 nfs-upload
[root@client-A ~]# useradd -g 222 -u 222 -m nfs-upload
#测试,可以看到创建的文件及目录默认属主为nfs-upload属组为nfs-upload
[@client-A upload]$ pwd
/opt/upload
[@client-A upload]$ ll
total 0
#测试创建文件
[@client-A upload]$ touch test123
测试创建目录
[@client-A upload]$ mkdir testdir
[@client-A upload]$ ll -a
total 4
drwxr-xr-x 3 nfs-upload nfs-upload 36 Sep 6 10:28 .
drwxr-xr-x. 4 root root 4096 Sep 6 18:22 ..
-rw-rw-r-- 1 nfs-upload nfs-upload 0 Sep 6 10:28 test123
drwxrwxr-x 2 nfs-upload nfs-upload 6 Sep 6 10:28 testdir
# 在客户端用root用户创建文件测试
root@client-A upload]# touch testabc
[root@client-A upload]# ll
total 0
-rw-r--r-- 1 root root 0 Sep 6 10:31 nfstest123
-rw-r--r-- 1 nfs-upload nfs-upload 0 Sep 6 10:32 testabc
drwxrwxr-x 2 nfs-upload nfs-upload 6 Sep 6 10:28 testdir
可以看到用root用户创建的文件属主仍是nfs-upload
#测试删除文件
[@client-A upload]$ rm test123
[@client-A upload]$ ll
total 0
drwxrwxr-x 2 nfs-upload nfs-upload 6 Sep 6 10:28 testdir
10. Linux搭建NFS服务器
作者:SpookZanG
linux搭建NFS服务器
一、什么是NFS服务
NFS是Network
File
System的简写,即网络文件系统.
网络文件系统是FreeBSD支持的文件系统中的一种,也被称为NFS.
NFS允许一个系统在网络上与它人共享目录和文件。通过使用NFS,用户和程序可以象访问本地文件一样访问远端系统上的文件。
二、NFS的优势
1.本地工作站使用更少的磁盘空间,因为通常的数据可以存放在一台机器上而且可以通过网络访问到。
2.用户不必在每个网络上机器里头都有一个home目录。Home目录
可以被放在NFS服务器上并且在网络上处处可用。
3.诸如软驱,CDROM,和
Zip®
之类的存储设备可以在网络上面被别的机器使用。这可以减少整个网络上的可移动介质设备的数量。
NFS至少有两个主要部分:一台服务器和一台(或者更多)客户机。客户机远程访问存放在服务器上的数据。为了正常工作,一些进程需要被配置并运行。
三、NFS的搭建
1、服务器端
安装NFS的服务程序
yum
install
-y
nfs-utils
写配置文件
写入
/music
192.168.0.0/255.255.255.0(rw,sync)
格式是:
要共享的目录
共享的IP及掩码或者域名(权限,同步更新)
启动服务
/etc/init.d/portmap
restart
/etc/init.d/nfs
restart
chkconfig
nfs
on
chkconfig
portmap
on
然后关闭防火墙以及更改Selinux关于NIS的选项
/etc/init.d/iptables
stop
(防护墙服务关闭)
chkconfig
iptables
off
system-config-selinux
(设置selinux)
2、客户端
编辑fstab文件,实现开机自动挂载
mount
-t
nfs
IP:/目录
挂载到的目录
(此为临时挂载)
如:mount
-t
nfs
192.168.0.9:/doce
/doc
编辑FSTAB文件
vim
/etc/init.d/fstab
IP:/目录
挂载到的目录
nfs
defaults
0
0
然后关闭防火墙以及更改Selinux关于NIS的选项
/etc/init.d/iptables
stop
(防护墙服务关闭)
chkconfig
iptables
off
system-config-selinux
(设置selinux)
至此,搭建完毕。