Linux Powered By Azure – YAWIP

On to step 3! We created a Ubuntu VM. We configured it to be LAMP ready. And now…YAWIP (Yet Another WordPress Installation Post). Yes, I am sorry. Another post about how to install WordPress. It is quite alright. WordPress is super popular and it goes nice with this series.

WordPress is available via the Azure Websites but sometimes you want more control over the features or server and these tutorials are meant for that.

Some requirements:

  • Azure subscription is needed. If you do not have one, please sign up for a free trial.
  • A computer to connect to the internet and run command line utilities.
  • I will be using a Mac to show how this is done, however the same mechanics can be applied to running other OS’s except for a few steps which I will point out.
  • Hopefully you completed the first and the second tutorial.

 

Getting WordPress

  • At a command prompt issue the following command:
    • wget http://wordpress.org/latest.tar.gz
  • This will download a zipped tar file for the wordpress Installation.
  • Uncompress it by issuing the following:
    • tar -xzvf latest.tar.gz
  • Hopefully you were in your user directory and you have a wordpress directory filled with all of the installation files.

Setting Up the Database

WordPress runs well with a MySQL database, and since we just installed it all we need to do is create a database and user.

  • Login to MySQL by: mysql -u root -p
  • Then create a DB:
    • CREATE DATABASE ubuntupress;
  • Then a user:
    • CREATE USER ubuntuuser@localhost;
  • Set the password
    • SET PASSWORD FOR ubuntuuser@localhost= PASSWORD(“12345678”);
  • Grant privileges
    • GRANT ALL PRIVILEGES ON ubuntupress.* TO ubuntupressuser@localhost IDENTIFIED BY ‘ubuntupress’;
  • Refresh the DB
    • FLUSH PRIVILEGES;
  • Then you can quit
    • exit;

Setting Up Apache

First we need to create a directory and then configure Apache to use that directory then we can move the files over.

  • Issue the command and replace the DNSNAME with the actual DNS name
    • sudo mkdir /var/www/DNSNAME.cloudapp.net
  • This is where we will place the WordPress files
    • sudo mv wordpress/ /var/www/DNSNAME.cloudapp.net/htdocs
  • Lets do some final clean up for permissions and ownerships
    • sudo chown -R $USER:$USER /var/www/DNSNAME.cloudapp.com/htdocs
    • sudo chmod -R 755 /var/www
  • If you navigate to that directory you will see all of the files. However, if you open a web browser you will not. We need to now tell Apache where our root is. This is done via what is called Virtual Hosts.
  • First we will copy over a file and then edit it.
    • sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/DNSNAME.cloudapp.conf
    • sudo vi /etc/apache2/sites-available/DNSNAME.cloudapp.conf
  • We need to edit the following:
    • ServerName – put in our servername (DNSNAME.cloudapp.net)
    • ServerAdmin – your email
    • DocumentRoot – location to your root /var/www/DNSNAME.cloudapp.com/htdocs
  • Save the file and enable it using an Apache utility
    • sudo a2ensite DNSNAME.cloudapp.net.conf
  • Then Apache needs to restart
    • sudo service apache2 restart

Open up your web browser and you should see the installation screen for WordPress!

wordpress-step-1

Enter the information we used to set up our MySQL database and click submit.

You may run into a permission error on the next screen, which is ok. Just hightlight the text in the textbox and paste it into a new file called wp-config.php located in the htdocs directory of your webroot (/var/www/DNSNAME.cloudapp.net/htdocs).

wordpress-step-2

 

…and..DONE!

wordpress-step-3

Leave a Comment

(1 Comment)

  • Michael

    Brilliant! Great step-by-step guide and all works like a charm on Azure. I’m frontend/UX and can follow easily. I’m spending a fraction of time installing LAMP manually compared to figuring out how to modify Bitnami. And the learning is invaluable so I 100% recommend going this route! BTW, 3 typos:
    1. sudo chown -R $USER:$USER /var/www/DNSNAME.cloudapp.com/htdocs >>> … cloudapp.NET/htdocs
    2. DocumentRoot – location to your root /var/www/DNSNAME.cloudapp.NET/htdocs >>> … cloudapp.net/htdocs
    3. sudo a2ensite DNSNAME.cloudapp.net.conf >>> … cloudapp.conf (no NET)

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