LoginSignup
0
0

More than 5 years have passed since last update.

VirtualBox と vagrantを使った開発環境

Last updated at Posted at 2017-01-16

PC上の作業ディレクトリと仮想マシンのディレクトリを同期(シンボリックリンク)させる方法

vagrant をインストールして、諸々設定する。
そのあと、ssh接続して /vagrant ディレクトリに移動するとVagrantfile がある。

$ vagrant ssh  
$ cd /vagrant

Vagrantfile

この Vagrantfile はローカルPC上にもできていて

$ cd /Users/YOURNAME/vagrant 

Vagrant file 

仮想マシンのapache が見に行くディレクトリは
/var/www/html

/var/www/html の /html は消しておく
rm -r html

同期されるディレクトリは
/vagrant

これをssh環境内でシンボリックリンクすればローカルPC上でも変更が同期されるようになる。
$ sudo ln -s /vagrant /var/www/html

【参考サイト】
Qiita: Vagrant+VirtualBoxでPHP開発環境構築
Qiita: vagrantを用いたPHPの環境構築

0
0
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
0
0