Ubuntu Server and WordPress in 15 Minutes Flat

Exclusive offer: get 50% off this eBook here
WordPress 3 Site Blueprints

WordPress 3 Site Blueprints — Save 50%

Ready-made plans for 9 different professional WordPress sites

$23.99    $12.00
by Christer Edwards | September 2010 | Linux Servers Open Source Web Development WordPress

This article by Christer Edwards outlines how to install Ubuntu Server from scratch, install and configure the LAMP (Linux Apache MySQL PHP) packages and get the Wordpress blogging software installed and configured in under 15 minutes. It may take more than that time to initially read the article, but after you've given it a once-over and have the required components ready, you'll be able to install a machine from scratch and have your own blog up and running in 15 minutes!

(For more resources on WordPress, see here.)

Introduction

Ubuntu Server is a robust, powerful and user-friendly distribution engineered by a dedicated team at Canonical as well as hundreds (if not thousands) of volunteers around the world. It powers thousands of server installations, but public and private and is becoming a very popular and trusted solution for all types of server needs.

In this article I will outline how to install Ubuntu server toward the goal of running and publishing your own blog, using the WordPress blogging software. This can be used to run a personal blog out of your home, or even run a corporate blog in a workplace. Hundreds of companies use Wordpress as their blogging software of choice—I've deployed it at my office even.

I personally maintain about a dozen Wordpress installations, all at varying levels of popularity and traffic. Wordpress scales well, is easy to maintain, and very intuitive to use. If you're not familiar with the Wordpress blogging software I'd invite you to go check it out at http://www.wordpress.com.

Requirements

In order to get this whole process started you'll only need a few simple things. First, a copy of Ubuntu Server. At the time of this writing, the latest release is 10.04.1 LTS (Long Term Support), which will be supported and provide security and errata updates for five years. You can download a free copy of Ubuntu Server here: http://www.ubuntu.com/server

In addition to a copy of Ubuntu Server you'll need, of course, a platform to install it one. This could be a physical server, or a virtual machine. Your times (the 15 minute goal) may vary based on your physical hardware speeds. I based this article on the following platform and specifications:

Dell D630

  • Core 2 Duo 2.10 Ghz
  • 2G RAM
  • VirtualBox 3.2.8 Open Source Edition

Again, your mileage may vary depending on your hardware and network, but overall this article will quickly get you from zero to blogger in no time!

The last requirement you'll need, and I mentioned this just very briefly in this last paragraph, is network access. If you're installing this on a physical machine, make sure that you'll have local network access to that machine. If you're planning on installing this on a virtual machine, make sure that you configure the virtual machine to use bridged networking, making it accessible to your local area network.

To recap, your requirements are:

  • Ubuntu Server 10.04.1 LTS .iso (or printed CD)
  • Physical or virtual machine to provision
  • Local network access to said machine

Getting started

Once you have everything prepared we can jump right in and get started. Start up your virtual machine, or drop in your CD-ROM, and we'll start the installation. I've taken screenshots of each step in the process so you should be able to follow along closely. In most situations I chose the default configuration. If you are unsure about the configuration requirements during installation, it is generally safe to select the default. Again, just follow my lead and you should be fine!

Ubuntu Server and WordPress

This is the initial installer screen. You'll notice there are a number of options available. The highlighted option (also the default) of "Install Ubuntu Server" is what you'll want to select here.

Ubuntu Server and WordPress

Next, the installer will prompt you for your preferred or native language. The default here is English, and was my selection. You'll notice that there is a huge number of available languages here. This is one of the goals and strengths of Ubuntu, "that software tools should be usable by people in their local language". Select your preferred language and move on to the next step.

Ubuntu Server and WordPress

The next step is to select your country. If you selected English as your primary language you'll then need to select your region. The default is United States, and was also my selection.

Ubuntu Server and WordPress

The Ubuntu installer can automatically detect your keyboard layout if you ask it to. The default prompt is no, which then allows you to select your keyboard from a list. I prefer to use the auto-detection, which I find a bit faster. You can use your own preference here, but be sure you select the correct layout. Nothing more frustrating than not being able to type properly on your keyboard!

Ubuntu Server and WordPress

Next you'll need to assign a hostname to your machine. This is an enjoyable part of the process for me, as I get to assign a unique name to the machine I'll be working with. This always seems to personalize the process for me, and I've chosen a number of creative names for my machines.

Select whatever you like here, just make sure it is unique compared to the other machines on your current network.

Ubuntu Server and WordPress

To help ensure that your clock is set properly the Ubuntu installer will auto-detect or prompt you for your time zone. I've found that, when installing on physical hardware, the auto-detection is usuall pretty accurate. When installing on virtual hardware it has a more difficult time. The screenshot above was taken on virtual hardware, which required me to select my time zone manually. If this is the case for you, find your time zone and hit ENTER.

Ubuntu Server and WordPress

The next step in the installation process is partitioning the disks. Unless you have specific needs here, I'd suggest safely selecting the defaults. If you're wondering whether or not you do have specific needs, you probably don't. For our intentions here toward the goal of setting up a web server to run Wordpress, the default is just fine.

Select "Guided – use entire disk and set up LVM" and hit ENTER.

Ubuntu Server and WordPress

The installer will prompt you with a confirmation dialog before writing partitioning changes to the disk. Based on the fact that making changes to partitions and filesystems will destroy any existing data on the disk(s), this requires secondary confirmation.

If you are installing on a newly created virtual machine you should have nothing to worry about here. If you are installing on physical hardware, please note that it will destroy any existing data and you should be OK with that action.

Ubuntu Server and WordPress

You also have the option of defining the size of the disk made available to your installation. Again, I selected the default here which is to use 100% of the available space. If you have more specific requirements, make them here.

Ubuntu Server and WordPress

Lastly, in regards to the partitioning, one more final confirmation. This screen outlines the partitions that will be created or changed and the filesystems and formatting that will be done on those partitions. Each of these filesystem related screenshots selected the default values. If you've done the same, and you're OK with losing any existing data that might be on the machine, finalize this change by selecting YES.

Ubuntu Server and WordPress

At this point the installer will install the base system within the newly created partitions. This will take a few minutes (again, your mileage may vary depending on hardware type). There are no prompts during this process, just a progress bar and a communication of the packages that are being installed and configured.

WordPress 3 Site Blueprints Ready-made plans for 9 different professional WordPress sites
Published: August 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

Read more about this book

(For more resources on WordPress, see here.)

Ubuntu Server and WordPress

Your new system will need to have at least one user created, and this user will be the initial Administrator. Ubuntu does not use by default the traditional root user, as is found on most other Linux distributions. The first user, generally yourself, will be able to act as the root user and do administrative work. In this field, simply enter your Full name. On my machine I entered "Christer Edwards".

Ubuntu Server and WordPress

You then have the option of selecting a username. Based on the Full name definition, the Ubuntu installation will make a suggestion (usually the first name). This may not be your preference. I prefer the username 'cedwards' over my actual first name. Enter your preferred username here and Continue.

Ubuntu Server and WordPress

The next step is to define a password. Make sure you select a strong, memorable password. Remember, this is the password that will be required to do any administrative work. If you can't remember it, you won't be able to administer your machine, but if someone else can guess it they'll have all power over your machine. I'll leave this up to you to choose wisely.

Ubuntu Server and WordPress

You'll need to confirm your password for verification. Of course, simply re-enter the password you chose on the previous step.

Ubuntu Server and WordPress

One of the nice additions that Ubuntu has made to their server offering is the option to securely encrypt each user's home directory. What this means is that unless you've logged into the machine and authenticated with your password, the contents of your home folder (all of your files, preferences, documents, etc) are securely encrypted from all other users. In addition, any time you log out your home folder is automatically re-encrypted and safely stored again. I feel this is a nice addition to the installation, but you can select your preference. If security and privacy are important to you, select the appropriate option here.

The upcoming steps of the installer will require network access. This step allows you to define any required proxy information you may have. If you do not connect through a proxy you can safely leave this field blank. If you do connect through a proxy (you'll likely know that you do!), enter the information here.

Ubuntu Server and WordPress

The upcoming steps of the installer will require network access. This step allows you to define any required proxy information you may have. If you do not connect through a proxy you can safely leave this field blank. If you do connect through a proxy (you'll likely know that you do!), enter the information here.

The allowable formats are defined in the description field above. Again, if you are unsure whether or not you need a proxy, you probably don't and can safely Continue at this step.

Ubuntu Server and WordPress

One of the last configuration options available before the actual installation begins is the choice of how to manage updates on the system. There are three options outlined. I generally select the second, "Install security updates automatically".

The first option will check for updates, and even notify you of their availability when you login, but will not apply any on its own.

The second option will check for updates and apply and security updates automatically. Other updates that might be disruptive, such as feature changes, are not applied automatically.

The third option, "Manage system with Landscape", allows you to tie this server into a web-management solution offered by Canonical (Ubuntu's parent company) called Landscape. Landscape allows you to manage configuration, and updates of multiple machines by way of a web interface. It is actually a very nice tool for those that have the infrastructure to require it. Find out more about Landscape here: http://www.canonical.com/enterprise-services/ubuntu-advantage/landscape.

Ubuntu Server and WordPress

We're finally to the actual installation portion, with one last question to answer. This is another option that makes Ubuntu a very robust and user-friendly solution for server needs. This prompt lists a number of pre-configured server solutions that are commonly used in a business environment. Options such as "DNS Server", "Mail Server", "Tomcat Java Server", etc, etc. In our situation, we'll be setting up a web server as a requirement for a WordPress installation, so we'll want to select “LAMP Server”. Again, LAMP stands for Linux Apache MySQL and PHP. These are the base requirements for robust web server, and all of the requirements for a WordPress installation. Simply hit the spacebar on that selection, an X should appear in the box, and you can continue.

I might also suggest selecting "OpenSSH Server" which will allow you remote console access for administration and configuration purposes. In my installation I selected both "LAMP Server" and "OpenSSH Server" and selected Continue.

Ubuntu Server and WordPress

Finally the installation kicks off and required (and selected) packages are installed. From this point forward the installation should be primarily automated, and it may be a good time to take a quick coffee break. Again, depending on the speed of your hardware, this will likely be the longest portion of the entire procedure.

Ubuntu Server and WordPress

Once all of the required packages are installed, the final question will be regarding the installation of the GRUB boot loader. This is an essential option, which if done improperly, will cause problems with booting your machine. Unless you know you have specific needs here, simply select the defaults and you should end up fine.

Ubuntu Server and WordPress

Congratulations! Your installation is now complete! You can select Continue to automatically reboot your machine. When the server boots back up you should be able to login with the username and password you defined earlier in the process. You will also have administrative rights for further configuration. That wasn't so bad, now was it?

Ubuntu Server and WordPress

Upon first logging in, Ubuntu Server presents the above information. This is something that you'll only find on Ubuntu Server. I've not seen it on any other distribution, and I think it is a very nice addition. You get a good overview of the state of your system, network information, and updates as available.

WordPress 2.8 Themes Cookbook Over 100 simple but incredibly effective recipes for creating powerful, custom WordPress themes
Published: July 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

Read more about this book

(For more resources on WordPress, see here.)

Now we'll get to the good part of installing and configuring WordPress. If you follow along closely, you'll be done in just a few minutes!

Ubuntu Server and WordPress

Before we configure WordPress we'll want to verify that our LAMP server installed properly. We'll want to check two things:

  1. We need to verify that Apache works.
  2. We need to verify that PHP is functioning properly.

In the above screenshot I've entered the IP address of my new server into the address bar of my web browser. If you're unsure what the IP address is you can find it back on the information screen when you first logged in, or you can type 'ifconfig'. You're looking for an IP address available on your local network. In my example, my virtual machine was given an address on my local area network of 172.16.24.48. This is the address I entered into my web browser. Assuming the LAMP server installed properly and the network is configured as expected, you should see the content in the screenshot above. "It works!".

Ubuntu Server and WordPress

We also need to ensure that our PHP installation is installed and configured properly. This can be done by doing the following:

  1. Open a terminal (Applications < Accessories < Terminal)
  2. Change directories to the Document Root of the web server using the command: cd /var/www/
  3. Change ownership on the directory such that your user and the web server will have access to the content using the command: sudo chown <username>:www-data
  4. Ensure that all future content will be group-owned by the web server using the command: sudo chmod g+s
  5. Create a small php script to test our PHP installation using the command: echo "<?php phpinfo(); ?>"" > index.php

You should now be able to refresh your browser and see a page similar to the screenshot above. If you don't see the page, try changing your URL to point to /index.php. The goal is to have the PHP script run and display it's configuration. If you see this page, your Apache and PHP configurations are setup properly.

That leaves us with only two things left to do before we have the WordPress software up and running.

  • First we'll need to configure a database for WordPress to use.
  • Second we'll need to download and install WordPress.

To configure a database, run the following command while still in your Terminal:

mysql -u root -p

This will prompt you for a password. During the initial installation you should have been prompted for a password for the MySQL installation. Enter that same password here. If you do not recall that password, or if you were not prompted for such, the following command can (re)prompt you for the MySQL database root password:

dpkg-reconfigure mysql-server

Ubuntu Server and WordPress

Once you're sucessfully able to login, you should be at a prompt similar to the screenshot above. This is the mysql monitor, the default console application to the MySQL database. We'll simply need to create a dedicated database for WordPress and a user to connect as. The following two commands should accomplish both goals:

CREATE DATABASE wordpress;

GRANT ALL PRIVILEGES ON wordpress.* TO
'wordpress'@'localhost' IDENTIFIED BY 'p@ssw0rd';

Of course, change "p@ssw0rd" to something unique, but otherwise the above two commands create a database for WordPress, allow access to the database to a specified user (wordpress) and define the password. We'll need all of this information for an upcoming step. If you followed my examples, it shouldn't be hard to remember. Finally, exit the database console using the commands "exit" or "quit".

Finally we're able to install the WordPress software. In this situation we'll install and track our WordPress installation using the subversion revision control tool. This will provide us with a number of benefits over the traditional downloaded .zip file method.

  1. Using subversion lets us easily check out specific revisions of the WordPress software.
  2. Using subversion lets us easily replace required files in case of accidental deletion.
  3. Using subversion lets us easily upgrade our installation with a single command.

Install the subversion tool using the command:

sudo apt-get install subversion

Finally, check out the latest (at the time of this writing) WordPress release using the command:

svn co http://core.svn.wordpress.org/tags/3.0.1/ blog

Ubuntu Server and WordPress

We're finally ready to install WordPress, which is done by way of a web-based installer. In the same web browser that you have open, change the url to /blog/ and you should be prompted with a screen similar to the one above. We should be ready and configured to get started, so go ahead and click "Create a Configuration File".

Ubuntu Server and WordPress

The next step in the installation is to notify you of the required pieces of information you'll need to present. You should have these readily available, but as an overview (assuming you've followed my examples), the details are as follows:

  1. Database name: WordPress
  2. Database username: WordPress
  3. Database password: p@ssw0rd (or, preferably, your replacement)
  4. Database host: localhost
  5. Table Prefix: wp_ (default option)

With all of these details sorted out, go ahead and click "Let's go!"

Ubuntu Server and WordPress

Enter the details as we've outlined on this screen and click "Submit".

Ubuntu Server and WordPress

"All right sparky", as the installer says. You've made it this far, let's finally "Run the Install".

Ubuntu Server and WordPress

Enter the following details and we'll be just about done.

  • Site title: Whatever you'd like to call your blog. Perhaps "Adventures with Ubuntu"
  • Username: preferred administrative username
  • Password: preferred administrative password
  • Your E-Mail: preferred contact email.

Ubuntu Server and WordPress

Success! You should now be able to login to your new WordPress installation with the username and password details you defined on the previous screen. You'll notice this screen reminds you of the administrative username, but the password is hidden. Click the "Log In" button to login to the Dashboard and begin blogging!

Ubuntu Server and WordPress

Welcome to your WordPress dashboard. From here you have all the power of the WordPress blogging engine at your fingertips. Perhaps you'd like to document your impressions of Ubuntu Server, the installation, or this article as one of your first posts. If these steps worked for you, a great way to say thank you is to publish a blog post and link to the article for others to share!

Summary

Ubuntu Server offers a robust and easy-to-use platform for managing a number of internet services, such as a WordPress powered blog engine. In this article we covered the requirements, installation and configuration of the server as well as the configuration of WordPress. In upcoming articles I will outline in more detail the Apache configuration needed to host multiple sites (WordPress or otherwise) as well as securing your site(s) with SSL encryption.


Further resources on this subject:


About the Author :


Christer Edwards currently works for a US Department of Defense Contractor maintaining Linux and FreeBSD Systems. In a previous life he was a Technical Instructor developing and teaching courseware for Red Hat Enterprise. While it is the Enterprise  that pays the bills, his real passion is in the Linux community trenches. He has been a long-time contributor to Ubuntu where he has maintained a technical blog on the Ubuntu Planet for over three years. He was also key in organizing the Ubuntu LoCo project throughout the US. An ideal day for him is one spent quietly writing documentation and articles.

Books From Packt


WordPress Plugin Development: Beginner's Guide
WordPress Plugin Development: Beginner's Guide

WordPress 2.9 E-Commerce
WordPress 2.9 E-Commerce

WordPress MU 2.8: Beginner's Guide
WordPress MU 2.8: Beginner's Guide

WordPress for Business Bloggers
WordPress for Business Bloggers

WordPress and Flash 10x Cookbook
WordPress and Flash 10x Cookbook

WordPress 2.8 Theme Design
WordPress 2.8 Theme Design

WordPress 2.7 Complete
WordPress 2.7 Complete

Mastering phpMyAdmin 3.1 for Effective MySQL Management
Mastering phpMyAdmin 3.1 for Effective MySQL Management


Your rating: None Average: 5 (8 votes)
Just used your guide. A good by
Just used your guide. A good guide, but there's a few errors in your instructions. For example these didn't work. Change ownership on the directory such that your user and the web server will have access to the content using the command: sudo chown :www-data Ensure that all future content will be group-owned by the web server using the command: sudo chmod g+s Create a small php script to test our PHP installation using the command: echo """ > index.php And I had to remove the final slash from svn co http://core.svn.wordpress.org/tags/3.0.1/ blog, and run with sudo.
Great tutorial. It's nice to by
Great tutorial. It's nice to see an linux guide that's written in human speak.
Thank You!! by
Your tutorial was informative and accurate, not to mention very helpful. Thanks again.
can't get the commands to work by
can anyone help me? The 1st step after installation works: I can change dir to cd /var/www but all the commands after that gives me error upon error. I have no clue re linux command prompts, but would assume as this is a 15min step by step that all commands should work. I tried it on Ubuntu 10.10 and on two different Virtual Boxes, and then downloaded 10.04.1 LTS, thinking that perhaps the commands differ. Please assist! Here's what I am getting: pcrr@PCRR:~$ cd /var/www pcrr@PCRR:/var/www$ sudo chown :www-data -bash: pcrr: No such file or directory pcrr@PCRR:/var/www$ sudo chmod g+s [sudo] password for pcrr: chmod: missing operand after `g+s' Try `chmod --help' for more information. pcrr@PCRR:/var/www$ echo """ > index.php > Thank you very much. Appy
Great tutorial, worked like a by
Great tutorial, worked like a charm!
Nice! This step by step by
Nice! This step by step introduction to setting up a server, complete with pictures at each point, is exactly what I've been looking for. When I start to work on this, I'll see if I can get it in 15 minutes. Thanks for the instructions and high level of detail!
Domain to website by
Great tutorial! But how do I assign a domain like "www.thisisatestdomain.com" to the blog? So that I can enter without typing the IP, but that domain.

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
z
x
7
f
s
n
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software