Installing WordPress on an Azure Ubuntu VM – Part 3

This is a 4 part series on configuring WordPress in Azure on its own dedicated VM.

Part 1 – Deploy an Azure Ubuntu VM
Part 2 – Install LAMP on the VM
Part 3 – Install and configure WordPress
Part 4 – Fixing the “quirks”

Part 3 – Install and configure WordPress

There are a few ways to install WordPress on Ubuntu however the way I like to do it is to download the latest build from http://wordpress.org and then extract to my local PC and the copy the files up to

Firstly create the folder as to where WordPress will be installed to:

sudo mkdir -p /var/www/akdemolabs.co.uk
sudo chown -R $USER:$USER /var/www/akdemolabs.co.uk
sudo chmod -R 755 /var/www
Sudo chmod 757 /var/www/akdemolabs5.co.uk

clip_image001[1]

Then get the latest build of WordPress and extract to the newly created folder:

wget -c http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo rsync -av wordpress/* /var/www/akdemolabs.co.uk

Next Create the Database:

mysql -u root -p
CREATE DATABASE akdemolabs;
CREATE USER AT365user@localhost IDENTIFIED BY ‘GHT56&*aaa_KJd’;
GRANT ALL PRIVILEGES ON akdemoalbs.* TO AT365user@localhost;
FLUSH PRIVILEGES;
Exit

Create the Website:

There are two ways to publish your site:

  1. Over HTTP
  2. Over HTTPS

I tend to create my site using HTTPS and have URL Redirects for HTTP.

If you are wanting to create a site secured by an SSL certificate follow these steps:

Enable the SSL Module by running:

sudo a2enmod ssl

Then you need to create the CSR For your certificate I used the following link https://www.digicert.com/easy-csr/openssl.htm to create the command I needed to generate my CSR:

clip_image002[1]

Please remember if you plan to have multiple names on your website to add these to the CSR.

Create an SSL certificate (I use www.namecheap.com) and then copy the 3 files to the website folder:

clip_image003[1]

And then create the following web config file on /etc/apache2/sites-avaialble:

<VirtualHost _default_:443>
ServerAdmin admin@akdemolabs.co.uk
DocumentRoot /var/www/akdemolabs.co.uk
ServerName akdemolabs.co.uk
ServerAlias www.akdemolabs.co.uk
SSLEngine on
SSLCertificateFile /var/www/akdemolabs.co.uk/certificate.crt
SSLCertificateKeyFile /var/www/akdemolabs.co.uk/private.key
SSLCACertificateFile /var/www/akdemolabs.co.uk/ca_bundle.crt
<Directory /var/www/akdemolabs.co.uk/>
AllowOverride All
</Directory>

</VirtualHost>

I called mine /etc/apache2/sites-available/akdemolabs_SSL.conf

clip_image004[1]

Save the site as it is and then run:

sudo a2ensite akdemolabs_SSL.conf this will enable the site and then prompt you to restart the apache2 service by running:

sudo service apache2 restart all being well apache will restart and the site will be enabled

This will enable the newly created SSL site

clip_image005[1]

clip_image006[1]

Setting up the URL Redirect

The URL redirect is just a simple edit to the config file and then a restart of the apache2 services:

Run sudo nano /etc/apache2/sites-avialble/akdemolabs_SSL.conf and add the following to the top of the config:

<VirtualHost *:80>
ServerName akdemolabs.co.uk
ServerAlias www.akdemolabs.co.uk
Redirect / https://akdemolabs.co.uk
</VirtualHost>
<VirtualHost _default_:443>
Rest of the initial conf file
</VirtualHost>

clip_image007[1]

Once Saved run: sudo services apache2 restart to restart apache and then try and browse to the site on Port 80 and you will be redirected to the SSL Site.

Configure WordPress

Go to your newly create website https://akdemolabs.co.uk (in this case)

And then follow the on screen instructions:

In order to configure WordPress you will need to specify the Database details created earlier on in this guide:

User: AT365user
Password: GHT56&*aaa_KJd’;
Database: Aakdemolabs

clip_image008[1]

clip_image009[1]

clip_image010[1]

clip_image011[1]

clip_image012[1]

clip_image013

clip_image014

And that’s it your WordPress blog is up and running.

Leave Comment

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