Skip to content

Instantly share code, notes, and snippets.

@luanlmd
Created July 6, 2016 19:22
Show Gist options
  • Select an option

  • Save luanlmd/fc14d7a3156ca845e40b1fa0ca43112d to your computer and use it in GitHub Desktop.

Select an option

Save luanlmd/fc14d7a3156ca845e40b1fa0ca43112d to your computer and use it in GitHub Desktop.
Vagrantfile LAMP
$script = <<SCRIPT
apt-get update
apt-get install sudo
gpasswd -a vagrant sudo
echo "mysql-server mysql-server/root_password password password" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password password" | debconf-set-selections
apt-get -y install mysql-server
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
mysql -uroot -ppassword -e "CREATE DATABASE dbname"
mysql -uroot -ppassword -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ''"
/etc/init.d/mysql restart
apt-get install libapache2-mod-php5 php5-curl php5-imagick php5-mysql php5-memcached -y
a2enmod rewrite
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
rm -Rf /var/www/html/
ln -s /vagrant/public/ /var/www/html
/etc/init.d/apache2 restart
SCRIPT
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, inline: $script
config.vm.network :forwarded_port, guest: 80, host: 8000
config.vm.network :forwarded_port, guest: 3306, host: 3306
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment