Install WordPress on Ubuntu 18.04.1 AWS instance.

Nothing particularly difficult here, I just decided to put it all together in one place.

This is for Ubuntu 18.04.1 on AWS.

Once you’re connected via SSH to your AWS instance just follow these steps.

Run Updates

sudo apt-get update

sudo apt-get upgrade

Install Apache

sudo apt install apache2

Install and Configure mysql

sudo apt install mysql-server

Configure MySQL

sudo mysql_secure_installation

Install other elements

sudo apt-get install php-mysql

Install PHP

sudo apt install php

Change Order for PHP

sudo nano /etc/apache2/mods-enabled/dir.conf

Restart Apache

sudo systemctl restart apache2

Check HTTP Access at this point.

Create PHP Test Page

sudo nano /var/www/html/info.php

Browse to IP Address with -info.php

Now remove files – sudo rm /var/www/html/info.php

Install other PHP Packages

sudo apt install php-curl

Create DB

sudo mysql -u root -p


CREATE USER ‘wordpressuser’@’localhost’ IDENTIFIED BY ‘PASSWORDHERE‘;

GRANT ALL ON wordpress.* TO ‘wordpressuser’@’localhost’ IDENTIFIED BY ‘PASSWORDHERE’;


Remaining PHP Elements

sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

Restart Apache

sudo systemctl restart apache2

Edit WordPress Config

sudo nano /etc/apache2/sites-available/wordpress.conf

Set the location of files in this case it should be as follows

<Directory /var/www/wordpress/>
AllowOverride All

Start Re-write

sudo a2enmod rewrite

Restart Apache

sudo systemctl restart apache2

Check Config

sudo apache2ctl configtest

Restart Apache Controller

sudo systemctl restart apache2

WordPress Download

cd /tmp
curl -O
Extract – tar xzvf latest.tar.gz

Create .htaccess

touch /tmp/wordpress/.htaccess

Copy Sample Config

cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php

Make Upgrade DIR

mkdir /tmp/wordpress/wp-content/upgrade

Copy files from tmp to WWW Location

sudo cp -a /tmp/wordpress/. /var/www/wordpress

Set Permissions

sudo chown -R www-data:www-data /var/www/wordpress
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;
sudo chmod -R 755 /var/www/wordpress/

Configure WP Config

Change Apache2.conf in /etc/apache2

Options Indexes FollowSymLinks
AllowOverride None
Require all granted

Change Directory

Edit both .conf files to reflect the correct www directory.

cd /etc/apache2/sites-available

sudo nano 000-default.conf
sudo nano wordpress.conf



Thanks all.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.