vagrantでCentOS起動して、LAMP環境構築を今更ながらにやってみる[その2]
前記事の続きです。
vagrantでCentOS起動して、LAMP環境構築を今更ながらにやってみる[その1] - Ich lerne Laravel und CakePHP
前回は、vagrantでCentOSを起動させて、sshでログインするところまでやりました。
今回はとりあえず、
をインストールして、
ローカルマシンから仮想マシンのサーバーに
アクセスするところまでを目標にしてます。
yumを最新版にする
[vagrant@localhost ~]$ sudo yum -y upgrade
- yをつけると、すべての質問にyesで答えてくれるらしいので、
これでさくっとupgradeする
と言っても、結構時間かかる(´・ω・`)
ApacheとMysqlとPHPのインストール via yum
[vagrant@localhost ~]$ sudo yum install httpd php php-mysql mysql mysql-server
これで必要なものは全部入ります
/etc/init.d/○○ start
httpdとmysqldを○○に入れてそれぞれを起動させてください。
vagrant reloadを一回かますと
Failed to mount folders in Linux guest. This is usually beacuse the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was: mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant
というエラーが出た。
なにやら、これはvagrant側でvboxをリビルドする必要があるらしい。
vagrant ssh
CentOSの中で、リビルドをかける。
[vagrant@localhost ~]$ sudo /etc/init.d/vboxadd setup Removing existing VirtualBox DKMS kernel modules [ OK ] Removing existing VirtualBox non-DKMS kernel modules [ OK ] Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module [ OK ] Building the shared folder support module [ OK ] Building the OpenGL support module [失敗] (Look at /var/log/vboxadd-install.log to find out what went wrong) Doing non-kernel setup of the Guest Additions [ OK ] [vagrant@localhost ~]$ exit
そして、ログアウトしてから再起動
$ vagrant reload
これで治った(。・ω・。)