By | 2014年8月1日

MacOS X上に仮想化ソフトウェアとしてVirtualBox、仮想環境管理ツールとしてVagrantを導入し、CentOS環境を構築する手順の記録。



・MacOS X 10.9.4
・VirtualBox 4.3.14
・Vagrant 1.6.3
・CentOS 6.4



(1) VirtualBoxのインストール


VirtualBox 4.3.14 for OS X hosts の x86/amd64
をクリックしてdmgファイルをダウンロードし、MacOS Xにインストール。


(2) Vagrantをインストール

MAC OS X Universal (32 and 64-bit)
をクリックしてdmgファイルをダウンロードし、MacOS Xにインストール。


(3) boxファイルをダウンロード

今回はCentOS 6.4 x86_64 Minimalを導入します。

$ vagrant box add centos64
==> box: Adding box 'centos64' (v0) for provider:
    box: Downloading:
==> box: Successfully added box 'centos64' (v0) for 'virtualbox'!
$ vagrant box list

centos64 (virtualbox, 0)



(5) 任意の場所に仮想マシン用のディレクトリを作成

$ mkdir centos
$ cd centos


(6) 仮想マシンの初期化

$ vagrant init centos64
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
`` for more information on using Vagrant.



(7) 仮想マシンの起動

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: centos_default_1406797151929_32405
==> 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:
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
==> 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: Guest Additions Version: 4.2.12
    default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
    default: /vagrant => /Users/****/centos



(8) 仮想マシンに接続

$ vagrant ssh
[vagrant@localhost ~]$




$ vagrant halt
==> default: Attempting graceful shutdown of VM...




メールアドレスが公開されることはありません。 * が付いている欄は必須項目です