仮想開発環境を構築しよう

#VirtualBox
https://www.virtualbox.org/wiki/Downloads
からダウンロードし、インストールする

#Vagrant
https://www.vagrantup.com/downloads.html
からダウンロードし、インストールする

#ゲストOS
コマンドプロンプトで下記コマンドを実行
vagrant box add ubuntu/xenial64 https://app.vagrantup.com/ubuntu/boxes/xenial64
==> box: Loading metadata for box 'https://app.vagrantup.com/ubuntu/boxes/xenial64'
==> box: Adding box 'ubuntu/xenial64' (v20180921.0.0) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20180921.0.0/providers/virtualbox.box
    box: Progress: 100% (Rate: 3269k/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'ubuntu/xenial64' (v20180921.0.0) for 'virtualbox'!

C:\20_wc\vagrant\work>vagrant box list
CentOS7         (virtualbox, 0)
ubuntu/xenial64 (virtualbox, 20180921.0.0)

C:\20_wc\vagrant\work>vagrant init ubuntu/xenial64
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.


C:\20_wc\vagrant\work>dir      ..
2018/10/02  08:13             3,098 Vagrantfile

C:\20_wc\vagrant\work>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/xenial64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: Setting the name of the VM: work_default_1538435837295_95451
==> 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: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.1.38
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /vagrant => C:/20_wc/vagrant/work

C:\20_wc\vagrant\work>