LoginSignup
2
2

More than 5 years have passed since last update.

Vagrantでローカル開発環境を構築する。

Posted at

環境の準備

VirtualBoxのインストール

brew cask install virtualbox

Vagrantのインストール

brew cask install vagrant

仮想マシンを構築する

  • 作業ディレクトリを作成する
cd
mkdir
cd workspace

boxファイルのURLを入手する

http://www.vagrantbox.es/ へアクセス
centosnのURLをコピー

  • vagrantコマンドでboxを追加する
vagrant box add centosxx "URL"
  • vagrantfile を生成する
vagrant init centosxx
  • vagrantfile をカスタマイズ
sudo vi Vagrantfile
config.vm.network "forwarded_port", guest: 80, host: 8888 を追記
config.vm.provider :virtualbox do |vb| と end のブロックにて、コメン トアウトを解除。ブロック内に下記2行を追記
vb.customize ["modifyvm", :id, "--memory", "1024"] vb.customize ["modifyvm", :id, "--cpus", 1
  • CentOS仮想マシンを作成する
vagrant up
  • CentOS仮想マシンに接続する
vagrant ssh
  • CentOS仮想マシンを作成する
vagrant up

CentOS仮想マシンに接続する

vagrant ssh
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2