nfs服务器搭建 如何Windows 7系统下如何搭建NFS服务器
各位老铁们好,相信很多人对nfs服务器搭建都不是特别的了解,因此呢,今天就来为大家分享下关于nfs服务器搭建以及如何Windows 7系统下如何搭建NFS服务器的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!
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)
至此,搭建完毕。
两台nfs服务器怎么搭建主备自动切换
方法如下:
1、首先建立 auto.master文件,没有的话就新建,如果存在的话修改下就行
我的原来就有,于是我就在此基础上修改的
########################
[root@localhost~]# vi/etc/auto.master
#
#$Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp$
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [-mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc/etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#"nosuid" and"nodev" options unless the"suid" and"dev"
# options are explicitly given.
#
/net-hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for/net or/misc(as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#+auto.master
/var/Net/Files/etc/auto.nfs
################
我把配置文件中红色的部分注释掉了,因为存在的话查看日志文件的话会有错误提示
tail-f/var/log/messages
Dec 2 08:52:21 localhost automount[6475]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
2、然后建立目录
mkdir/var/Net/Files
注意,要保证 Files目录是空的
3、建立 auto.nfs配置文件
[root@localhost~]# vi/etc/auto.nfs
temp-rw,bg,soft,rsize=32768,wsize=32768 10.2.2.136:/var/Net/Files/temp
UPGRADE_FILE-rw,bg,soft,rsize=32768,wsize=32768 10.2.2.136:/var/Net/Files/UPGRADE_FILE
UPGRADE_DOC-rw,bg,soft,rsize=32768,wsize=32768 10.2.2.136:/var/Net/Files/UPGRADE_DOC
4、136是服务器,137是客户端,红色部分需要和服务器中的exports配置文件相对应
[root@localhost rsync]# cat/etc/exports
/var/Net/Files/temp
/ 10.2.2.137(rw,no_root_squash)
/var/Net/Files/UPGRADE_DOC
/ 10.2.2.137(rw,no_root_squash)
/var/Net/Files/UPGRADE_FILE
/ 10.2.2.137(rw,no_root_squash)
服务器要开启 portmap和 nfs服务
[root@localhost rsync]#/etc/init.d/portmap restart
[root@localhost rsync]#/etc/init.d/nfs restart
5、客户端启动 autofs服务
[root@localhost Files]#/etc/init.d/autofs restart
查看日志,保证没有错误
tail-f/var/log/messages
查看服务端是否开启/提供服务
[root@localhost Files]# showmount-e 10.2.2.136(服务端)
Export list for 10.2.2.136:
/var/Net/111 10.2.2.137
/var/Net/Files/temp 10.2.2.137
/var/Net/Files/UPGRADE_DOC 10.2.2.137
/var/Net/Files/UPGRADE_FILE 10.2.2.137
6、测试的方法就是
cd/var/Net/Files目录中看不见任何内容,
然后
cd UPGRADE_FILE
cd UPGRADE_DOC
cd temp
能进去,能使用,差不多就这样
如何Windows 7系统下如何搭建NFS服务器
Windows 7系统下搭建NFS服务器方法:
一、软件安装:
1、从百度搜索haneWIN,下载下来后,双击运行,出现界面后点“下一步”即可。
2、设置安装路径,选择即可。
3、是设置开始菜单下的文件名,默认即可,点“下一步”继续安装。
4、配置成功后,点击“安装”开始软件的安装,后面会自动安装完成。
二、软件配置:
1、修改exports文件:打开安装包下的exports文件,把D盘下的temp文件夹做为输出目录,这里可根据情况修改即可(-name:nfs不用去改)D:\temp-name:nfs。
2、替换安装目录下的exports文件:修改完后保存关闭,找到haneWIN软件的安装文件夹,替换掉原来的exports即可。
三、重启nfs服务器:从开始菜单下找到haneWIN软件,选择NFS下的重启所有服务即可。
关于nfs服务器搭建的内容到此结束,希望对大家有所帮助。