Linux WordPress

Installing WordPress on Ubuntu (or similar Debian based)

This is what I do to get WordPress running on both Ubuntu 11.04 and the current CrunchBang Statler. This is just for getting development environments running quickly, don’t follow this blindly if you’re setting up a live public facing server.

First of all I install the wordpress package. I don’t actually use the installed WordPress, but it just makes sure everything is installed that you need.

apt-get update
apt-get install wordpress libssh2-php mysql-server

libssh2-php allows us to install themes and plugins via ssh which I prefer to the ftp methods.  When installing mysql I don’t set a password for root – so just hit return each time it asks you. It will ask you a number of times. When everything is installed it’s time to download the latest WordPress from their site. I keep all my development sites in a projects directory so I do:

cd ~/projects
wget http://wordpress.org/latest.tar.gz
tar -zxpvf latest.tar.gz
mv wordpress zobbo.org

These files will need to be writeable by the webserver so I add myself to the www-data group and make the new project directory read-writeable by the same group:

sudo adduser ian www-data
sudo chmod -R g+rw zobbo.org

Now let’s create our database

mysqladmin create zobbo.org -u root

The final thing we need to do is setup our webserver to server this. I add an entry for our server into my local hosts file and create an apache virtual config for it.

sudo emacs -nw /etc/hosts

and add the line

127.0.0.1       zobbo.local

Now create our new apache config

sudo emacs -nw /etc/apache2/sites-available/zobbo.org

and put the following into it

<VirtualHost *:80>
    ServerName  zobbo.local
    ServerAdmin ian@zobbo.org
    DocumentRoot /home/ian/projects/zobbo.org
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/ian/projects/zobbo.org>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

We need to enable the site and also allow for URL writing as I like to use prettier permalinks. So we do:

sudo a2ensite zobbo.org
sudo a2enmod rewrite
sudo /etc/init.d/apache2 reload

Now if you open your web browser and go to http://zobbo.local you’ll go through the WordPress installation procedure. Fill in the details and your site should be up and running within minutes.

Leave a Reply

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