Posted at

Vagrant synced_folder で nfs を使用する

More than 3 years have passed since last update.

Host OS: osx 10.11.3

Guest OS: CentOS5.9

VirtualBox 5.0.14

HostOS 側 /etc/exports に sudo NOPASS で編集できるようにする


Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports

Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports

GuestOS側で nfs client をインストールする

sudo yum -y install nfs-utils nfs-utils-lib

下記の様にエラーログがでるので、ゲスト側に nfs-utils nfs-utils-lib をインストールする

The following SSH command responded with a non-zero exit status.

Vagrant assumes that this means the command failed!

yum -y install nfs-utils nfs-utils-lib

Stdout from the command:

Loaded plugins: fastestmirror, priorities
Determining fastest mirrors
Could not retrieve mirrorlist error was
[Errno 4] IOError: <urlopen error (101, 'Network is unreachable')>

Stderr from the command:

Error: Cannot find a valid baseurl for repo: base

ホストとゲスト側の通信を StaticIPにする "private_network", ip: ""

下記の様なエラーログが出るので、private_network を有効にする

NFS requires a host-only network to be created.

Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work