Vagrant:Host OS と Guest OS 間でファイル共有
Host OS と Guest OS 間でファイル共有
実行環境
HOST OS:Windows 7 Professional
RAM:2GB
GUEST OS:CentOS 6.6
現在の状況
同期フォルダーはvagrantfileに以下の設定を記述している。
default: /vagrant => C:/vagrant/CentOS 6.6
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p /vagrant
Stdout from the command:
Stderr from the command:
sudo: sudo ■■■■■■■■■■■■■■■■■■■■ tty ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
sudoでエラーが出ているようなので、visudoで以下の設定をして再起動。
Defaults: !requiretty
==> default: Mounting shared folders...
default: /vagrant => C:/vagrant/CentOS 6.6
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p /vagrant
Stdout from the command:
Stderr from the command:
sudo: ■■■■■■ (tty) ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ (askpass) ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
さらに以下の設定を追加して再起動
ALL=(ALL) NOPASSWD:ALL
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'CentOS 6.6'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: CentOS66_default_1429857936135_93663
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => C:/vagrant/CentOS 6.6
以上の設定をvagrantユーザーにのみ適用するように上記設定は元に戻し、下記設定を最終行に追加。
これでフォルダの同期が可能になった。
- 作者: Mitchell Hashimoto,Sky株式会社玉川竜司
- 出版社/メーカー: オライリージャパン
- 発売日: 2014/02/21
- メディア: 単行本(ソフトカバー)
- この商品を含むブログ (9件) を見る