Vagrant initでvagrantの初期化

Vagrant initでvagrantを初期化し、vagrant fileを作ります。

公式ドキュメントに沿って実行しましょう。
getting-started

1.マウントするフォルダを作成
ローカルのコマンドライン
>mkdir precise
>cd precise

2.vagrant init
vagrant fileを作ります。
>vagrant init hashicorp/precise64
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.

3.vagrant up
コマンドラインで vagrant upと打ち込みます。
ubuntu 12.04 LTS 64-bitが入る様です。最初のvagrant upは時間がかかります。
After running the above two commands, you will have a fully running virtual machine in VirtualBox running Ubuntu 12.04 LTS 64-bit.

>vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Box ‘hashicorp/precise64’ could not be found. Attempting to find and install…
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box ‘hashicorp/precise64’
default: URL: https://vagrantcloud.com/hashicorp/precise64
==> default: Adding box ‘hashicorp/precise64’ (v1.1.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box
default: Progress: 100% (Rate: 3371k/s, Estimated time remaining: –:–:–)
==> default: Successfully added box ‘hashicorp/precise64’ (v1.1.0) for ‘virtualbox’!
==> default: Importing base box ‘hashicorp/precise64’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘hashicorp/precise64’ is up to date…
==> default: Setting the name of the VM: precise_default_1544857642397_69575
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports…
default: 22 (guest) => 2222 (host) (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:
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] GuestAdditions versions on your host (5.1.26) and guest (4.2.0) do not match.
Reading package lists…
Building dependency tree…
Reading state information…
The following extra packages will be installed:
fakeroot linux-headers-3.2.0-23 make patch
Suggested packages:
make-doc diffutils-doc
The following NEW packages will be installed:
dkms fakeroot linux-headers-3.2.0-23 linux-headers-3.2.0-23-generic make
patch
0 upgraded, 6 newly installed, 0 to remove and 66 not upgraded.
Need to get 12.7 MB of archives.
After this operation, 68.5 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main make amd64 3.81-8.1ubuntu1 [118 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/main patch amd64 2.6.1-3 [80.2 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise/main dkms all 2.2.0.3-1ubuntu3 [73.1 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise/main fakeroot amd64 1.18.2-1 [87.2 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ precise/main linux-headers-3.2.0-23 all 3.2.0-23.36 [11.4 MB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ precise/main linux-headers-3.2.0-23-generic amd64 3.2.0-23.36 [947 kB]
dpkg-preconfigure: unable to re-open stdin: No such file or directory
Fetched 12.7 MB in 56s (226 kB/s)
Selecting previously unselected package make.
(Reading database … 51095 files and directories currently installed.)
Unpacking make (from …/make_3.81-8.1ubuntu1_amd64.deb) …
Selecting previously unselected package patch.
Unpacking patch (from …/patch_2.6.1-3_amd64.deb) …
Selecting previously unselected package dkms.
Unpacking dkms (from …/dkms_2.2.0.3-1ubuntu3_all.deb) …
Selecting previously unselected package fakeroot.
Unpacking fakeroot (from …/fakeroot_1.18.2-1_amd64.deb) …
Selecting previously unselected package linux-headers-3.2.0-23.
Unpacking linux-headers-3.2.0-23 (from …/linux-headers-3.2.0-23_3.2.0-23.36_all.deb) …
Selecting previously unselected package linux-headers-3.2.0-23-generic.
Unpacking linux-headers-3.2.0-23-generic (from …/linux-headers-3.2.0-23-generic_3.2.0-23.36_amd64.deb) …
Processing triggers for man-db …
Setting up make (3.81-8.1ubuntu1) …
Setting up patch (2.6.1-3) …
Setting up dkms (2.2.0.3-1ubuntu3) …
Setting up fakeroot (1.18.2-1) …
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode.
Setting up linux-headers-3.2.0-23 (3.2.0-23.36) …
Setting up linux-headers-3.2.0-23-generic (3.2.0-23.36) …
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 3.2.0-23-generic /boot/vmlinuz-3.2.0-23-generic
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: warning: /mnt seems to be mounted read-only.
Installing Virtualbox Guest Additions 5.1.26 – guest version is 4.2.0
Verifying archive integrity… All good.
Uncompressing VirtualBox 5.1.26 Guest Additions for Linux………..
VirtualBox Guest Additions installer
Removing installed version 4.2.0 of VirtualBox Guest Additions…
Copying additional installer modules …
Installing additional modules …
vboxadd.sh: Starting the VirtualBox Guest Additions.

Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.1.26. Some functionality may not work as intended.
In most cases it is OK that the “Window System drivers” installation failed.
vboxadd.sh: Starting the VirtualBox Guest Additions.
vboxadd.sh: failed: modprobe vboxsf failed.

Could not find the X.Org or XFree86 Window System, skipping.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 4.2.0
VBoxService inside the vm claims: 5.1.26
Going on, assuming VBoxService is correct…
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 4.2.0
VBoxService inside the vm claims: 5.1.26
Going on, assuming VBoxService is correct…
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 4.2.0
VBoxService inside the vm claims: 5.1.26
Going on, assuming VBoxService is correct…
Restarting VM to apply changes…
==> default: Attempting graceful shutdown of VM…
==> 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 reset. 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 =>

puttyでログインする