Skip to content

Instantly share code, notes, and snippets.

@bajanReece
Created February 25, 2014 16:26
Show Gist options
  • Save bajanReece/9212338 to your computer and use it in GitHub Desktop.
Save bajanReece/9212338 to your computer and use it in GitHub Desktop.
Quick LAMP setup
# 1. Install Apache
sudo apt-get -y install apache2
# 2. Install MySQL, you'll be asked for a root password
sudo apt-get -y install mysql-server mysql-client
# 2.1. the next step is optional, but it tidies things up and secures your db installation
sudo mysql_secure_installation
# 3. Install PHP
sudo apt-get -y install php5 libapache2-mod-php5 php-pear php5-cli php5-mysql php-apc php5-adodb php5-imagick php5-gd php5-mcrypt php5-memcache php5-memcached php5-curl php5-dev
# 4. Install support for PECL and for Make and Build of apps
sudo apt-get -y install build-essential libpcre3-dev libcurl3-openssl-dev
# 5. Install PECL extensions as required
sudo pecl install OAuth
############################################################################
######################## AWS orientated configuration ######################
############################################################################
# Assuming you're on an Ubuntu instance ...
# 6. Add the ubuntu user to the www-data group, this will give the user the required file permissions
sudo usermod -a -G www-data ubuntu
# 7. Update the ownsership of the /var/www directory
sudo chown -R root:www-data /var/www
# 8. Change the permissions in the directory, and make them sticky, so that future
# directories created will have the same permissions
sudo chmod 2775 /var/www
# 8.1. Update the permissions of directories, and make the permissions sticky
find /var/www -type d -exec sudo chmod 2775 {} +
# 8.2. Update the permissions of files, and make them sticky
find /var/www -type f -exec sudo chmod 0664 {} +
Now the ubuntu user (and any future members of the www-data group) can add, delete, and edit files in the Apache document root. Now you are ready to add content, such as a static website or a PHP application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment