Skip to content

Instantly share code, notes, and snippets.

@simonwhatley
Forked from JeffreyWay/install.sh
Last active August 29, 2015 14:22
Show Gist options
  • Save simonwhatley/49e56f61795715ab0335 to your computer and use it in GitHub Desktop.
Save simonwhatley/49e56f61795715ab0335 to your computer and use it in GitHub Desktop.
LAMP install script
#!/usr/bin/env bash
# Update the package list
sudo apt-get update
sudo apt-get upgrade -y
# Install more recent PPA (do not do that except you are sure of what you are doing)
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
# Install basic packages
sudo apt-get install -y python g++ make git subversion curl
sudo ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
# Install PHP and Web server related modules
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-readline mysql-server-5.5 php5-mysql git-core php5-xdebug
# Enable mode rewrite
sudo a2enmod rewrite
# Change a few PHP settings
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = \"Europe/London\"/" /etc/php5/apache2/php.ini
sudo sed -i "s/disable_functions = .*/disable_functions = /" /etc/php5/cli/php.ini
# Configure XDebug
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
EOF
# Apache Restart
sudo service apache2 restart
# Install MySQL
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 mysql-server
# Allow remote access
sudo sed -i "s/^bind-address.*/\#bind-address/" /etc/mysql/my.cnf
sudo service mysql restart
# Install and configure Sendmail
sudo apt-get install -y sendmail
sudo hostname precise64.localdomain
sudo sed -i "s/^127\.0\.1\.1\tprecise64.*/127\.0\.1\.1\tprecise64 precise64.localdomain/" /etc/hosts
# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment