ubuntu安装nfs server

在Ubuntu上安装nfs-kernel-server时遇到启动错误,通过重新配置portmap并使用service命令解决权限和锁定问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

最近需要使用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

错误解决。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值