Skip to content

Instantly share code, notes, and snippets.

@hirayama-evolni
Last active August 29, 2015 14:26
Show Gist options
  • Save hirayama-evolni/9797fcaa568d533f1f87 to your computer and use it in GitHub Desktop.
Save hirayama-evolni/9797fcaa568d533f1f87 to your computer and use it in GitHub Desktop.
とりあえずLAMPを上げるVagrantfile
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
# 必要なもの:
# Oracle VirtualBox https://www.virtualbox.org/
# Vagrant https://www.vagrantup.com/
#
# それぞれダウンロード&インストールしてください。
# VagrantはC:\HashiCorp\Vagrant\binにPATHを通す必要があるかも知れません。
#
# 起動 … vagrant up
# 再起動 … vagrant reload
# 停止 … vagrant halt
# 消去 … vagrant destroy
Vagrant.configure(2) do |config|
# centos6を使います。
config.vm.box = "chef/centos-6.5"
# デフォルトではlocalhost:8080でVM側のhttpdにアクセスできるようにします。
config.vm.network "forwarded_port", guest: 80, host: 8080
# または、下記のようにローカルのIPアドレスを割り当てることもできます。
# config.vm.network "private_network", ip: "192.168.33.10"
# デフォルトでは、Vagrantfileと同じディレクトリがhttpdのDocumentRootになります。
# 必要に応じて第一引数を変更してください。
config.vm.synced_folder ".", "/var/www/html"
# パッケージのインストール&小細工
# apache+php+mysql
config.vm.provision "shell", inline: <<-SHELL
yum install -y httpd mysql-server php php-mysql php-pdo php-intl php-mbstring php-xml
chkconfig httpd on
echo "EnableSendfile off" >> /etc/httpd/conf/httpd.conf
sed -i.bak -e "s/AllowOverride None/AllowOverride All/" /etc/httpd/conf/httpd.conf
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
echo "date.timezone = Asia/Tokyo" >> /etc/php.ini
service httpd start
chkconfig mysqld on
service mysqld start
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment