1-4. OS実装
## Vagrantfileの編集
D:\VM\Vagrantfileをテキストエディタで編集しましょう。
Vagrant.configure("2") do |config| config.ssh.insert_key = false config.vm.define "centos72" do |node| node.vm.box = "centos72" node.vm.network "forwarded_port", guest: 22, host: 10022 node.vm.network "forwarded_port", guest: 8888, host: 18888 node.vm.network "private_network", ip: "192.168.100.100", virtualbox__intnet: "mynetwork" end end
centos72という名前を2つ使っちゃったのでややこしいのですが、
"centos72"を**"BOX"**として(元のイメージとして使って)、
"centos72"という**"VM"**を作っています。
ついでに、SSHの22ポートを10022ポートに転送し、Jupyterの8888ポートを18888ポートに転送しています。
これでコントロール側のWindowsのポートからバーチャルのLinuxにアクセスできるようになります。
ネットワークの設定は必要ないんですが、いちおう"192.168.100.100"というIPアドレスをVMマシン間だけのネットワークに与えています。
## 編集が終わったら、いよいよ起動!
D:\VM>vagrant up Bringing machine 'centos72' up with 'virtualbox' provider... ==> centos72: Importing base box 'centos72'... ==> centos72: Matching MAC address for NAT networking... ==> centos72: Setting the name of the VM: VM_centos72_1482892505840_48934 ==> centos72: Clearing any previously set network interfaces... ==> centos72: Preparing network interfaces based on configuration... centos72: Adapter 1: nat centos72: Adapter 2: intnet ==> centos72: Forwarding ports... centos72: 22 (guest) => 10022 (host) (adapter 1) centos72: 8888 (guest) => 18888 (host) (adapter 1) centos72: 22 (guest) => 2222 (host) (adapter 1) ==> centos72: Booting VM... ==> centos72: Waiting for machine to boot. This may take a few minutes... centos72: SSH address: 127.0.0.1:2222 centos72: SSH username: vagrant centos72: SSH auth method: private key centos72: Warning: Remote connection disconnect. Retrying... centos72: Warning: Remote connection disconnect. Retrying... centos72: Warning: Remote connection disconnect. Retrying... ==> centos72: Machine booted and ready! ==> centos72: Checking for guest additions in VM... centos72: The guest additions on this VM do not match the installed version of centos72: VirtualBox! In most cases this is fine, but in rare cases it can centos72: prevent things such as shared folders from working properly. If yo u see centos72: shared folder errors, please make sure the guest additions within the centos72: virtual machine match the version of VirtualBox you have installed on centos72: your host and reload your VM. centos72: centos72: Guest Additions Version: 4.3.30 centos72: VirtualBox Version: 5.1 ==> centos72: Configuring and enabling network interfaces... ==> centos72: Mounting shared folders... centos72: /vagrant => D:/VM ==> centos72: Machine already provisioned. Run `vagrant provision` or use the `- -provision` ==> centos72: flag to force provisioning. Provisioners marked to run always will still run. D:\VM>
BOXをコピーしてVMを作り、起動が始まります。
[次は、PuTTYで接続へ](/2016/12/makejupyter15.html)