Install WordPress on Ubuntu with Amazon AWS EC2 VPS server the old manual way

Create your MySQL database on Amazon AWS RDS

The main difference on this tutorial  about EC2 WordPress setup is that we use a RDS database in stead of installing the database on the Ubuntu server. This saves considerable with CPU and RAM. When the EC2 VPS runs short of CPU and or memory, the first thing that suffers is the MySQL database. This again leads to that your WordPress goes down.

Use Sequel Pro, MySQL Workbench or Navicat create a empty database. The easiest way is to tunnel trough EC2 to RDS using SSH.

Download WordPress and create the root directory

Become admin on the server

sudo su

Create a directory where you will install WordPress.

mkdir /var/www/c.tbt.no

(replace c.tbt.no with your domain name)

Go to the home user area.

cd /home/ubuntu

Then dowload WordPress

wget https://wordpress.org/latest.zip

Unzip the package after installing the unzip utility.

apt-get install unzip

Unzip wordpress

unzip latest.zip

Copy WordPress to the correct folder

cd wordpress
cp -r . /var/www/c.tbt.no 

(replace c.tbt.no with your domain name)

    Remove the installation files from the home area

cd ..
rm -r wordpress
rm latest.zip
Check to se that the files and folders really are removed:

ls -a

 

EC2 WordPress setup
EC2 WordPress setup

WordPress need permissions on the file system

Give permissions so that the WP updates will work.

chown -R www-data /var/www/c.tbt.no

 

Activate .htaccess

Sometimes you might need to activate .htaccess in the main apache config file. The config file is located here:

sudo nano /etc/apache2/apache2.conf

 

Search for the expression “Options Indexes FollowSymLinks“b. Do this by pressing “CTRL + W” and paste the expression into the Nano search field.
Find the following three lines:

 Options Indexes FollowSymLinks
 AllowOverride None
 Require all granted

Change the word “None” to “All”.
The correct version would look like this:

 Options Indexes FollowSymLinks
 AllowOverride All
 Require all granted

Then restart Apache

 sudo service apache2 restart

 

Activate mod_rewrite

Sometimes you might need to activate mod_rewrite

a2enmod rewrite

– and then restart Apache

service apache2 restart

 

Add PHP-GD support to the Apache webserver

If you are running NextGenGallery you will ned this:

sudo apt-get install php7.0-gd

 

Add this to your php.ini file:

sudo nano /etc/php/7.0/apache2/php.ini

Add the following line:

extension=php_gd2.so

 

Run the WP installer to complete the EC2 WordPress setup

Go to your domain and run the installer.

 Checking the Apache logs

If something is wrong then the log files could be an nice starting point.

nano /var/log/apache2/error.log

To delete the error log:

rm /var/log/apache2/error.log

Check the Apache log:

nano /var/log/apache2/access.log

Delete the Apache log:

rm /var/log/apache2/access.log

Restart Apache

service apache2 restart

Optional steps

Set up centralized administration using ManageWP. Set up SMTP sending from WordPress using Amazon SES and appropriate plugin.  Buy a 3 year contract on your EC2 instance to get the best price.

Recomendations

We recommend using Thesis design framework from http://DIYthemes.com

Articles in this serie