LoginSignup
28
28

More than 5 years have passed since last update.

VagrantとVirtualBoxでの仮想環境構築(Windows版)

Last updated at Posted at 2014-11-11

VirtualBox

以下よりインストールする
https://www.virtualbox.org/wiki/Downloads

Vagrant

以下よりインストールする
http://www.vagrantup.com/
バージョン確認しておく。

C:\>vagrant -v
Vagrant 1.6.3

環境構築

boxの追加

以下よりインストールしたいboxをコピー
http://www.vagrantbox.es/
boxはまだないので、、、

C:\>vagrant box list
There are no installed boxes! Use `vagrant box add` to add some.

box追加

C:\>vagrant box add centos-6.5 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
==> box: Adding box 'centos-6.5' (v0) for provider:
    box: Downloading: https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
    box: Progress: 100% (Rate: 1174k/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'centos-6.5' (v0) for 'virtualbox'!

追加されたことを確認

C:\>vagrant box list
centos-6.5 (virtualbox, 0)

vagrantfile作成

C:\>cd dev
C:\dev>vagrant init cetos-6.5
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

vagrant起動

C:\dev>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos-6.5'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: dev_default_1412865650779_99865
==> 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: 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: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

失敗している。。。
64bitOSの仮想化支援機能が有効になっていなからとのこと。
BIOSの設定で有効にして

C:\dev>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    defau
lt: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> 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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/dev

無事完了。

SSH接続

teratermやPoderosa等のターミナルエミュレータで接続する。

項目
ホスト 127.0.0.1
ポート 2222
USER vagrant
秘密鍵 C:\Users\{USER}\.vagrant.d\insecure_private_key
28
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
28