In this tutorial, we’re talking on something a little heavier than in tutorials of past. We’re going to, step by step, installing WordPress on a fresh VPS with Ubuntu installed. If you like to sit back and watch it all be done, you can watch the video above while I go through the entire WordPress install process. While it’s not my best recording work, it should get the job done and you’ll see what it is we’re doing. Of course there’s the written guide, but things might be better explained in the video above.

Let’s just get started.

You’ll need the following:

  • Ubuntu Dedicated Server or VPS
  • Root Password
  • IP Address
  • Domain name for WordPress with an A record point to the IP address (DNS)
  • PuTTY

Open up PuTTY and login using the root username and password. First thing you’ll want to do is update and upgrade your maching, so run the following commands.

apt-get update
apt-get upgrade

Setting up Apache

Note: Really the first thing you could do at this point before anything else make sure the timezone of your server is correct. Here is a tutorial on how to do that really quick.

First thing we want to do for this WordPress installation is install Apache, our web server software. So install it using the following command. Keep in mind, you might already have Apache installed, but run this command anyway to make sure.

apt-get install apache2

We want mod_rewrite turned on for Apache.

a2enmod rewrite

Now we need to create a virtual host in Apache for domain name we’re installing WordPress on. We’re going to need a text editor to create the file, so let’s install nano.

apt-get install nano

Using nano, let’s create a new virtual host file inside the sites available folder.

nano /etc/apache2/sites-available/website_name.tdl

Paste in the following text into this file. If you get confused here, I recommend watching the video above.

<VirtualHost *:80>
	ServerAdmin [email protected]_name.tdl
	ServerName website_name.tdl
	ServerAlias www.website_name.tdl
	DocumentRoot /var/www/website_name.tdl/public_html/
	ErrorLog /var/www/website_name.tdl/logs/error.log
	CustomLog /var/www/website_name.tdl/logs/access.log combined
	<Directory /var/www/nwebsite_name.tdl/public_html>
		Options FollowSymLinks
		AllowOverride All
		RewriteEngine On
		RewriteCond %{HTTP_HOST} ^www.website_name.tdl$ [NC]
		RewriteRule ^(.*)$ http://website_name.tdl/$1 [R=301,L]

Hit Ctrl+X to exit nano, save the file. Now we need to make the directories we’ve referenced in that virtual host.

mkdir /var/www/website_name.tdl
mkdir /var/www/website_name.tdl/public_html
mkdir /var/www/website_name.tdl/logs

Next, let’s enable the virtual host we just created.

a2ensite website_name.tdl

We can restart Apache and have these settings take effect.

service apache2 restart

Setting up MySQL

Let’s install the MySQL server like so.

apt-get install mysql-server

During the installation, it will prompt you for a root user password. Go ahead and set the password, and write it down somewhere. After that it should complete the installation on its own.

Once that’s done, run the following command to…in a way ‘secure’ the installation.


This will ask you a couple questions. Change root password? No. Remove anonymous users? Yes. Disallow remote root login? Yes. Remove test database? Yes. Reload privileges now? Yes.

Now that MySQL is installed and ready to go, let’s create our database and user for WordPress to use. Login to mysql using the following command.

mysql -u root -p

It will ask you for the root password you just set. Once logged into the MySQL shell, first let’s create the database.

create database wordpress;

Now, let’s add a user and password that has all privileges to that database.

grant all on wordpress.* to 'sajan' identified by 'mysqlPass';

Now let’s have it all take into effect then exit out of mysql back onto our server.

flush privileges;

Setting Up PHP

Let’s install the php packages that we’ll need for WordPress.

apt-get install php5
apt-get install php-pear
apt-get install php5-mysql
apt-get install php5-suhosin

Install WordPress

Here’s where the magic happens. We’ve got our entire server ready for this, so now let’s download and install WordPress. Let’s go into our created public_html folder.

cd /var/www/website_name.tdl/public_html

Let’s download, unzip, move files, and delete the zip and folder all in one go to get everything were we want it be by running the following commands.

cp -rf ./wordpress/* ./
rm -rf wordpress

Let’s rename the sample config file to the one we want to use.

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

Let’s open up that config file using nano.

nano wp-config.php

Fill in all the details of that config file as outlined on the WordPress documentation. Once you’ve filled it in, save that using Ctrl+X.

Next we’re just going to clean up some permission issues.

chown -R www-data:www-data /var/www/website_name.tdl/public_html
chmod -R 775 /var/www/website_name.tdl

That’s It!