- Oracle 社の OS 仮想化 (VM = Virtual Machine) 製品で OSS
- いわゆるハイパーバイザ型の仮想化 (よく比較される VMware はホスト型)
- Docker が流行ってからあんまり触ってないが、Windows 確認でたまに使う
- VirtualBoxでKernel driver not installed(rc=-1908)と表示される場合の対処
- mac の security 設定のせい
- virtual box を uninstall => install して、環境設定からセキュリティ許可
Microsoft が IE / Edge の開発・検証のための VM を、VirtualBox など各プラットフォーム向けに無償提供してくれている。いけめん。
- パスワードは
Passw0rd!
- メモリ 8 GB / CPU 2 スレ / グラボ 128 MB くらいに設定しておく
- ネットワークはデフォルトでホスト NAT 経由にしておけばだいたいいいはず
/Users/{USER_NAME}/Downloads
とかを「共有フォルダ」としてD:
あたりにマウントしとくと楽- 準仮想化インターフェイスを
Hyper-V
にすると早い
- 一応 10.0.2.2 で host に接続できる (default 設定)
- hosts 上書きは新しいバージョンだとできないっぽい
- netsh で portproxy を必要な port 分だけかますしかない
- 管理者権限 command prompt から ↓ connectport を変えて
localhost:3000
でいける
# よくある 3000 port の proxy
$ netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=3000 connectaddress=10.0.2.2 connectport=3000
# 9000 とか 9099 とかあれば必要に応じてやる
$ netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=9000 connectaddress=10.0.2.2 connectport=9000
$ netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=9099 connectaddress=10.0.2.2 connectport=9099
# VM の確認
$ VBoxManage list vms
> "myproject_default_1528084845822_7803" {a770c439-141e-42b1-96a0-74998df80b68}
# ポートフォワーディングの Rule 未適用を確認 ( NIC 1 に Rule(0) しかない )
$ VBoxManage showvminfo myproject_default_1528084845822_7803 | grep '^NIC'
> NIC 1: MAC: 080027C363C3, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
> NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
> NIC 1 Rule(0): name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
> NIC 2: MAC: 08002722D18C, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth
# ポートフォワーディング設定 ( 8000 ポートを利用 )
$ VBoxManage controlvm "myproject_default_1528084845822_7803" natpf1 "http,tcp,10.0.1.151,8000,,80"
# ポートフォワーディングの Rule 適用を確認 ( NIC Rule(0) に http が追加された )
$ VBoxManage showvminfo myproject_default_1528084845822_7803 | grep '^NIC'
> NIC 1: MAC: 080027C363C3, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
> NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
> NIC 1 Rule(0): name = http, protocol = tcp, host ip = 10.0.1.151, host port = 8080, guest ip = , guest port = 80
> NIC 1 Rule(1): name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
> NIC 2: MAC: 08002722D18C, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth
# 必要ならば firewalld 設定
$ firewall-cmd --add-port=8000/tcp --zone=public --permanent
$ firewall-cmd --reload
$ firewall-cmd --list-ports --zone=public
> 8000/tcp
# Rule の削除
$ VBoxManage controlvm myproject_default_1528084845822_7803 natpf1 delete browse
# firewalld ポート設定の削除
$ firewall-cmd --remove-port=8080/tcp --zone=public --permanent
$ firewall-cmd --reload