ubuntu安装nfs server

 

最近需要使用ubuntu的nfs server功能,刚开始按照原先在redhat的配置方式,首先按照ubuntu的nfs install 方法,安装了下面的功能。

ken@ken-VirtualBox:/tftp$ sudo apt-get install nfs-kernel-server nfs-common portmap

但是启动server的时候,总是出现下面的的一些错误。

ken@ken-VirtualBox:/tftp$ sudo /etc/exports restart
bash: /etc/exports: Permission denied
ken@ken-VirtualBox:/tftp$  sudo /usr/sbin/exportfs  -av
exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/tftp".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exporting *:/tftp
exportfs: could not open /var/lib/nfs/.etab.lock for locking: errno 13 (Permission denied)
exportfs: could not open /var/lib/nfs/.etab.lock for locking: errno 13 (Permission denied)
exportfs: can't lock /var/lib/nfs/etab for writing
ken@ken-VirtualBox:/tftp$ sudo /usr/sbin/exportfs  -av
exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/tftp".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exporting *:/tftp

 

经过分析,原来是需要重新配置portmap.

ken@ken-VirtualBox:/tftp$ sudo dpkg-reconfigure portmap

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap stop

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop portmap
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap start

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start portmap
portmap start/running, process 3950
There are RPC services which were registered with the portmapper
before the configuration was changed.
You need to manually restart them in order for the changes to take effect.
Current registered services:
------------------------------------------------
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049
    100227    3   tcp   2049
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049
    100227    3   udp   2049
    100021    1   udp  58978  nlockmgr
    100021    3   udp  58978  nlockmgr
    100021    4   udp  58978  nlockmgr
    100021    1   tcp  49026  nlockmgr
    100021    3   tcp  49026  nlockmgr
    100021    4   tcp  49026  nlockmgr
    100005    1   udp  51458  mountd
    100005    1   tcp  46549  mountd
    100005    2   udp  51458  mountd
    100005    2   tcp  46549  mountd
    100005    3   udp  51458  mountd
    100005    3   tcp  46549  mountd
    100024    1   udp  49798  status
    100024    1   tcp  48828  status
------------------------------------------------


然后重新执行
ken@ken-VirtualBox:/tftp$ sudo /etc/exports restart

错误解决。

 

你可能感兴趣的:(Linux,Development)