Skip to content

Instantly share code, notes, and snippets.

@nathanmac
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanmac/b4963cf1b53a237b0623 to your computer and use it in GitHub Desktop.
Save nathanmac/b4963cf1b53a237b0623 to your computer and use it in GitHub Desktop.
LAMP Stack
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get install -y php5 libapache2-mod-php5 php5-cli php5-curl php5-gd php5-mcrypt php5-readline php5-mysql
sudo apt-get install -y apache2
sudo apt-get install -y npm
sudo apt-get install -y git-core
sudo apt-get install -y mysql-server-5.5
#sudo apt-get install -y openssh-server
sudo a2enmod rewrite
# Config vhost for application
cat << EOF | sudo tee /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin support@example.com
DocumentRoot /var/www/site
<Directory /var/www/site>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
# Config php settings
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
sed -i "s/disable_functions = .*/disable_functions = /" /etc/php5/cli/php.ini
echo "ServerName localhost" | sudo tee -a /etc/apache2/apache2.conf
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment