Linux Tweaks, HowTo's and Reviews

In this first part of How To Install WordPress on Ubuntu, I'm going to show some of the things you need to do to prepare your system for the actual WordPress installation. I'll cover the steps of installing WordPress itself in Part 2.

Install LAMP

LAMP stands for Linux, Apache, MySQL, php. This is the basic web server setup you need to host a website. Even though you won't be hosting the site out to the internet, you'll need to have LAMP installed and configured to run WordPress on your computer. This tutorial assumes that you already have Ubuntu installed. Then, install LAMP on Ubuntu.

Configure Apache websites

Once you have LAMP installed and configured, you may want to set up your website to run from a directory under your user ID instead of /var/www. This can be done with some basic Apache http server configuration.

Change Apache run user and run group

In order for the WordPress automatic update function to work, the username running WordPress must match the username running Apache. You can change the Apache username by editing some parameters in the /etc/apache2/envvars file. Hit <Alt><F2> on your keyboard and enter the command

gksudo gedit /etc/apache2/envvars

In the text editor that comes up, change the following two lines

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

and replace www-data with your user ID and default group (your default group most likely has the same name as your user ID. For my case, this would be linerd and linerd.) Save the file and restart Apache with

sudo /etc/init.d/apache2 restart

If you get an error like "apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for localhost," you can fix it with this command.

echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

Then reload Apache and the error should be gone.

sudo /etc/init.d/apache2 reload

If you end up having trouble with phpMyAdmin, then you need to add your ID to the www-data group.

Okay. Another snag for me. Before I edit envvars, http://localhost/phpmyadmin/ works. After editing for my id and group, it does not. Restoring to www-data fixes this. Any insight to what I may be doing wrong?

It looks like you need to add your userID to the www-data group. I had done that as I was trying to get WordPress to work properly and forgotten about it after I made the change to envvars. So make the change to /etc/apache2/envvars as shown in the post. Then add your usedID to the www-data group. You can do this through the menus from System→Administration→Users and Groups, or from the terminal with:

sudo adduser yourid www-data

Then restart Apache with

sudo /etc/init.d/apache2 restart

Thanks for helping to debug my blog post! Looks like I have an update to make.

The first screen should ask if you want to reinstall the database for phpmyadmin. Say "Yes". The next screen will ask you for a password for the administrative account (root). Enter the password you want, tab to OK and hit Enter. The next screen will ask about web server configuration. Make sure "apache2" is selected with a * (highlight and hit the space bar if it's not marked). Then OK.

Then clear your browser cache and see if you can get in. If that doesn't work, I'm stumped.