Skip to content

Instantly share code, notes, and snippets.

@horiK94
Created February 5, 2018 17:31
Show Gist options
  • Save horiK94/8cbfa87a1d45ea892503d82623af1db9 to your computer and use it in GitHub Desktop.
Save horiK94/8cbfa87a1d45ea892503d82623af1db9 to your computer and use it in GitHub Desktop.
仮想環境内でNode.jsをDLする

仮想環境内でNode.jsをDL

VirtualBoxとVagrantの違い

  • Virtual Box

仮想化ソフトウェアの1つ。コンピュータ上に仮想的なコンピュータ(仮想マシン)を作成することができる。その中でOSを起動して操作することができる。

  • Vagrant

仮想マシンをとてもシンプルに構築・操作するソフトウェア。Virutal Boxを代理で操作するソフトウェアである。Vagrantを利用して構築される仮想マシンはVirutalBoxで構築される仮想マシンと同じ。しかし、今まで行なっていた複雑なコマンド操作がとてもシンプルなコマンドに集約されている点や、仮想化ソフトウェアの製品による操作の違いを吸収してくれるため、仮想マシンの構築に対するハードルを一気に下げた。

Vagrantを使えば数行で仮想環境の構築が完了するようになったのだ

仮想環境の構築を行う

  1. VagrantのDL
  2. vagrant init
  3. vagrantfileの設定を行う (config.vm.box, config.vm.box_urlの設定を行う)
  4. VagrantBoxのurlをコピーしておく (VagrantBoxとはBoxファイルのことで、Boxファイルとは仮想マシンの起動の際にベースとなるイメージファイルのこと。Vagrant利用の上で最低限必要な設定も行なっているのが普通(参考URL))
  5. vagrant add {title} {url}
  6. vagrant up
  7. vagrant ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment