Installing WordPress on a VPS [part4]

Installing WordPress on Ubuntu Gutsy. You already need to have Mysql, Apache and PHP install (see here)

Change to you www directory

cd /var/www

and get and extract the latest WordPress gz

sudo wget
sudo tar xvfz latest.tar.gz

Now we need to create a database for wordpress

mysql -u root -p

Enter the root password you assigned when installing Mysql

Create the database

mysql> create database wp;

Now assign privileges to mysql user. You can chose your own username and password

mysql> GRANT ALL PRIVILEGES ON wp.* TO "wpuser"@"localhost"
> IDENTIFIED BY "userpassword";
mysql> exit;

Now we need to create a wp-config.php file and enter the settings above

sudo mv wp-config-sample.php wp-config.php

Replace all of the ^M’s on the end of the lines by using the following command. To enter the ^M you need to type "CTRL-V CTRL-M" NOT BY TYPING "CARROT M"

sudo sed 's/^M//g' -i wp-config.php

Now repalce the default settings with the ones you entered above. You can use vi or similar if you prefer.

sudo sed 's/putyourdbnamehere/wp/g' -i wp-config.php
sudo sed 's/usernamehere/wpuser/g' -i wp-config.php
sudo sed 's/yourpasswordhere/wpuserpassword/g' -i wp-config.php

Now to setup Apache. I don’t want the default configuration file – I’ll only be running my WordPress site on this server

cd /etc/apache2

Set the server name – obviously change it to your own

sudo echo ServerName >> apache2.conf
cd sites-available

You may want to change some configuration below. Especially the email address.

sudo -s
cat >> wordpress << EOF
NameVirtualHost *

ServerAdmin [email protected]
DocumentRoot /var/www/wordpress

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
cd ../sites-enabled/
sudo rm 000-default
sudo ln -s ../sites-available/wordpress wordpress

Start up Apache

sudo /etc/init.d/apache2 start

point your web browser at your homepage and (hopefully!) follow the instructions to setup WordPress

This post is part of a 4 part series that goes from getting a vps, securing it, installing LAMP and installing WordPress.The 4 parts are –

Setting up a vps with [part1]

Securing my Ubuntu VPS [part2]

Installing Mysql and Apache [part3]

My VPS was from and was running under XEN.

The configuration is 256Mb memory & 10Gb disk space for $18 a month.

The vps was provisioned with Ubuntu Fiesty Fawn but I upgraded that to the latest version – Gutsy Gibbon

3 thoughts on “Installing WordPress on a VPS [part4]

  1. small business websites

    See, having a website isn’t going to help your business at all if it doesn’t show up extremely high in Google’s search results. Anytime a person searches for something on Google, Google will return a page with the top ten websites they consider most relevant to the search term. The average person who’s looking for a carpet cleaner in Kalamazoo, or a wedding photographer in Boise, isn’t going to dig through pages and pages of Google’s search results. Furthermore, when someone does a Google search for a local business, if your website isn’t on that first page of results, the odds are very high that they’re NOT going to click on your website to see what you have to offer.

  2. matt Post author

    Hi Mike,

    Thanks. You’re right it’s a couple of years old now though. If you’d like to write an updated version I’ll publish it with a link to your website? 🙂

Comments are closed.