您的位置:首页 > 运维架构 > Linux

archlinux平台下 fl2440 主机nfs服务器搭建

2010-10-28 21:40 375 查看
参考archlinux wiki

https://wiki.archlinux.org/index.php/NFS_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)


这里需要安装的软件包写的是

服务器端和客户端所需要的软件包都是很少的。
你只需要安装:
core/portmap
core/nfs-utils


通过yaourt安装

[leftover-crazy@leftover-crazy ~]$ yaourt portmap
1 core/rpcbind 0.2.0-2 [installed]
portmap replacement which supports RPC over various protocols
==> Enter n° of packages to be installed (ex: 1 2 3 or 1-3)
==> -------------------------------------------------------
==>


发现 portmap 已经被1 core/rpcbind 0.2.0-2 [installed]替代了 而且本机也已经安装了

接着安装nfs-utils

[leftover-crazy@leftover-crazy ~]$ yaourt nfs
1 core/mkinitcpio-nfs-utils 0.2-1
ipconfig and nfsmount tools for NFS root support in
mkinitcpio
2 core/nfs-utils 1.2.2-3
Support programs for Network File Systems
3 core/nfsidmap 0.23-3
Library to help mapping IDs, mainly for NFSv4
4 extra/aufs2 2.6.35_20100802-2
Another Unionfs Implementation
5 extra/aufs2-util 20100802-1
Another Unionfs Implementation that supports NFS branches
6 community/perl-file-nfslock 1.20-6
NFS compatible (safe) locking utility


选择第二个安装顺利

checking package integrity...
(3/3) checking for file conflicts                  [########] 100%
(1/3) installing librpcsecgss                      [########] 100%
(2/3) installing nfsidmap                          [########] 100%
(3/3) installing nfs-utils                         [########] 100%
==> PLEASE NOTE:
==> Extended configuration options for NFS (clients & server) are available in
==> /etc/conf.d/nfs-common.conf and in /etc/conf.d/nfs-server.conf
==>
==> Please refer to http://wiki.archlinux.org/index.php/Nfs ==> for further information on NFS; for NFSv4, refer to
==> http://wiki.archlinux.org/index.php/NFSv4


接下来是配置文件的修改:

[leftover-crazy@leftover-crazy ~]$ sudo vim /etc/exports


/etc/exports内容如下
# /etc/exports
#
# List of directories exported to NFS clients.  See exports(5).
# Use exportfs -arv to reread.
#
# Example for NFSv2 and NFSv3:
#  /srv/home       hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
#  /srv/nfs4	   hostname1(rw,sync,fsid=0)
#  /srv/nfs4/home   hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
#  /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt)
#  /srv/nfs4/home   gss/krb5i(rw,sync,nohide)
#
/home/leftover-crazy/arm 192.168.1.2(rw,no_subtree_check,async,no_root_squash,nohide)


可以根据自己的实际情况修改目录 ip 权限等参数

接着修改/etc/conf.d/nfs-common.conf

[leftover-crazy@leftover-crazy ~]$ sudo vim /etc/conf.d/nfs-common.conf


内容为

# Parameters to be passed to nfs-common (nfs clients & server) init script.
#
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=""
# Options to pass to rpc.statd.
# See rpc.statd(8) for more details.
# N.B. statd normally runs on both client and server, and run-time
# options should be specified accordingly.
# STATD_OPTS="-p 32765 -o 32766"
STATD_OPTS="--no-notify"//只改动了这里
# Options to pass to sm-notify
# e.g. SMNOTIFY_OPTS="-p 32764"
SMNOTIFY_OPTS=""
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=""
# Options to pass to rpc.idmapd.
# See rpc.idmapd(8) for more details.
IDMAPD_OPTS=""
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=""
# Options to pass to rpc.gssd.
# See rpc.gssd(8) for more details.
GSSD_OPTS=""
# Where to mount rpc_pipefs filesystem; the default is "/var/lib/nfs/rpc_pipefs".
PIPEFS_MOUNTPOINT=""
# Options used to mount rpc_pipefs filesystem; the default is "defaults".
PIPEFS_MOUNTOPTS=""


修改/etc/hosts.allow

sudo vim /etc/hosts.allow


内容如下:

#
# /etc/hosts.allow
#
nfsd: 192.168.1.2
rpcbind: 192.168.1.2
mountd:192.168.1.2
# End of file


重启服务:

[leftover-crazy@leftover-crazy ~]$ sudo /etc/rc.d/rpcbind restart
:: Stopping rpcbind                                        [DONE]
:: Starting rpcbind                                        [DONE]
[leftover-crazy@leftover-crazy ~]$ sudo /etc/rc.d/nfs-common restart
:: Stopping rpc.idmapd daemon                              [FAIL]
:: Starting rpc.statd daemon                               [DONE]
:: Mounting pipefs filesystem                              [BUSY] :: Starting rpc.idmapd daemon                              [DONE]
[leftover-crazy@leftover-crazy ~]$ sudo /etc/rc.d/nfs-server restart
:: Stopping rpc.mountd daemon                              [FAIL]
:: Mounting nfsd filesystem                                [DONE]
:: Exporting all directories                               [DONE]
:: Starting rpc.nfsd daemon                                [DONE]
:: Starting rpc.mountd daemon                              [DONE]
[leftover-crazy@leftover-crazy ~]$


至此nfs服务器搭建完成

开机自启动设置
sudo vim /etc/rc.conf


If you want to mount on boot, make sure network, rpcbind (portmap), nfs-common (nfslock) and netfs are in the DAEMONS array in /etc/rc.conf.

DAEMONS=(@syslog-ng @network cpufreq netfs crond hal @fam  @wicd @alsa @sensors @hddtempi @rpcbind @nfs-common )


挂载mount -o rw,nolock 192.168.1.10:/home/leftover-crazy/arm/ /tmp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: