Skip to content

Instantly share code, notes, and snippets.

@YarGnawh
Last active February 19, 2016 16:51
Show Gist options
  • Save YarGnawh/10c234e1870887641caf to your computer and use it in GitHub Desktop.
Save YarGnawh/10c234e1870887641caf to your computer and use it in GitHub Desktop.
Setup LAMP & Wordpress for AWS EC2 Ubuntu 14.04
# Always run this line first
sudo apt-get update
# Almost always install a web server
sudo apt-get install -y apache2
# Install PHP + Apache PHP Module
sudo apt-get install -y php5 libapache2-mod-php5 php5-mcrypt
sudo apt-get install -y php5-gd libssh2-php
# Install PHP APC to speed up PHP and Wordpress
sudo apt-get install -y php-apc
echo 'extension = apc.so' | sudo tee --append /etc/php5/apache2/php.ini > /dev/null
echo 'apc.shm_size = 64' | sudo tee --append /etc/php5/apache2/php.ini
echo 'apc.stat = 0' | sudo tee --append /etc/php5/apache2/php.ini
# Enable Apache mod_rewrite for pretty permalink URLs
sudo a2enmod rewrite
# If enabling mod_rewrite, must add the following the Apache host configuration
<VirtualHost *:80>
<Directory /var/www/scilex>
Allowoverride All
</Directory>
<//VirtualHost>
# Install MySQL Server
sudo apt-get install -y mysql-server php5-mysql
# ALWAYS RESTART AFTER INSTALLTION
sudo service apache2 restart
# Install Varnish
# sudo apt-get install varnish
# Install Zip and Unzip
sudo apt-get install -y zip unzip
# Install Wordpress CLI
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
# Create MySQL Database for Wordpress
mysql -u root -p
# Inside MySQL Prompt
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost;
FLUSH PRIVILEGES;
exit
# Open Apache web root
cd /var/www
# Download Latest Wordpress
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzvf latest.tar.gz
# Rename "wordpress" folder to something better
sudo mv wordpress aBetterFolderName
# Change ownership for site root to Apache
sudo chown -R www-data:www-data aBetterFolderName
# Open folder
cd aBetterFolderName
# Create Wordpress Config file
sudo cp wp-config-sample.php wp-config.php
# Update wp-config.php with database settings
sudo vi wp-config.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment