仮想化手順
まず最初に
BIOSの設定で仮想化支援機能(Intel VT-d)をオンにすること。
Virtual BOXのインストール
ダウンロードURL
インストール方法
- welcome to the Oracle VM VirtualBox 5.1.18 setup wizard→Next>
- Custom Setup→Next>
- Next>
- Warning : Network Interfaces(ネットワーク切断の警告(瞬断が起きます))→Yes
- Ready to Install→Install
※インストール中にいくつか他のインストールを求められるので、すべてインストールする
Oracle VM VirtualBox Extension Pack インストール
ダウンロードURL
インストール方法
- Oracle VM VirtualBoxマネージャーを起動
- ファイル>環境設定≫機能拡張 →「新しいパッケージを追加」でOracle VM VirtualBox Extension Packを選択
Vagrantインストール
ダウンロードURL
インストール方法
- welcome to the Vagrant Srtup Wizard→Next
- End-User License Agreement→I accept the terms in the License Agreementにチェック→Next
- Destination Folder→Next
- Ready to install Vagrant→Install
- Completed the Vagrant Setup Wizard→Finish
- You must restart your system for the configuration~(再起動が必要です)→Yes
Microsoft Visual C++ 2010 再頒布可能パッケージ (x86)インストール
ダウンロードURL
- 言語を選択:日本語 でダウンロード
ディレクトリの作成、移動
仮想環境配置場所
- コマンドプロンプトで作業 (※フォルダ名は自由、ここではcentos73と入力)
- mkdir:ディレクトリの作成
- C:> mkdir C:\centos73
- cd:ディレクトリの移動
- C:> cd C:\centos73
BOXのダウンロード
- コマンドプロンプトで作業
-
bento/centos-7.3をダウンロードする
ダウンロードするファイルについては(https://atlas.hashicorp.com/bento)参照- C:\centos73> vagrant box add bento/centos-7.3
Enter your choice: の表示が確認出来れば「2」と入力する。
→Enter your choice: 2-
ダウンロードが出来たことを確認する
- C:\centos73> vagrant box list
設定ファイル(Vagrantfile)の自動生成
- コマンドプロンプトで作業
- C:\centos73> vagrant init bento/centos-7.3
設定ファイル(Vagrantfile)の手動修正
- ソースを直接編集(さくらエディタなどで開く)
編集ファイル:C:\centos73\Vagrantfile
29行目 コメントアウト解除
# config.vm.network "private_network", ip: "192.168.33.10"
→ config.vm.network "private_network", ip: "192.168.33.10"
46行目 コメントアウト解除
# config.vm.provider "virtualbox" do |vb|
→ config.vm.provider "virtualbox" do |vb|
52行目 追加(#vb.memory = "1024" のあと)
vb.name = "vg_centos7.3"
53行目 コメントアウト解除
# end
→ end
最終行から1行上(endの前の行)に追加
config.ssh.insert_key = false
仮想マシンの作成
- コマンドプロンプトで作業
- C:\centos73> vagrant up
(※2回目以降は起動コマンドになる)
※もし下記のエラーが発生した場合は無視してよい
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
作成した環境を確認する
- TeraTermなどSSH接続出来るツールを使用する
IP:192.168.33.10
ID:vagrant PW:vagrant (一般ユーザ)
ID:root PW:vagrant (root)
仮想マシンの停止
- 必ず最後に停止すること
- C:\centos73> vagrant halt
参考URL
Windows10でのvagrantによるCentOS7.2仮想マシン作成手順
https://itbyari.wordpress.com/2016/08/06/windows10%E3%81%A7%E3%81%AEvagrant%E3%81%AB%E3%82%88%E3%82%8Bcentos7-2%E4%BB%AE%E6%83%B3%E3%83%9E%E3%82%B7%E3%83%B3%E4%BD%9C%E6%88%90%E6%89%8B%E9%A0%86/VirtualBoxをWindowsにインストール
http://vboxmania.net/content/virtualbox%E3%82%92windows%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB