Setting up a website with Linode

This is my first website with Linode and I have been quite happy with the experience. This post will explain how quickly it was to set up a functioning website on the VPS service.

Setting up Linux
The first step in setting up a Linode server is choosing the Linux distro and installing it on your available space. I chose Ubuntu 8.04 LTS as previous experiences with older Ubuntu servers made me realize that constant upgrades on a server is not really that desirable. Linode have their own Linux images available to the user and the Ubuntu image installed very quickly with only SSH enabled. Within 10 minutes I was able to log in to the root account with no problem.

Setting up the server

Having a basic server with only SSH makes sense as not all users may require the full LAMP stack and may simply wish to host a database, web, or etc. server on their node. However in my instance I needed the full LAMP stack and get it set up quickly using the following commands:
  • apt-get install ubuntu-standard - Updates Linode's minimal Ubuntu install to something most experienced users of Ubuntu are more accustomed to.
  • apt-get install lamp-server^ - Installs the full LAMP stack needed to host a website.
  • a2enmod rewrite - Enables mod rewrite.
  • dpkg-reconfigure tzdata - Set the correct timezone.
Some of the above will take longer to run than others and apt-get will also ask you to confirm whether you want to download the X MB of packages as well as set up your root MySQL password. But Ubuntu's comprehensive packages really shine here so not much work is needed. Now you have a fully functioning LAMP server ready to host web pages and applications.

To make the server available to the web the DNS entry must also be configured. Linode makes this very easy by providing their own DNS server and web-based interface; which can be quite limiting at times, but that is for another post.

The Linode DNS servers are,, etc. up to Set this as the location of your DNS servers in your domain name registrar's settings. I use GoDaddy for my registrar that allowed editing of these settings in their domain name manager web app.

Once you have set up your domain name's DNS records you will need to Add a new domain zone in Linode Manager's DNS Manager. It is very easy to spot once you login. Linode is pretty good with documentation and following their hints in setting up a domain zone will give you a pretty complete zone file that points to your server.

Once you have added the zone file you will need to wait for Linode's DNS servers to refresh, which takes up to 15 minutes, then you can check your settings by typing from your root account dig If your settings were right you should see the answer section's record showing the correct server IP for your server. Then it is just a matter of waiting for your ISP, or switch to Open DNS, to update their server records. I find Open DNS normally gathers updates within an hour while ISPs can take up to two days.

Setting up the website

Although this is not related to Linode and many sources abound for information on how to set up a website in Ubuntu I will add it here for completeness' sake.

The first step is to add a new user for the website's account. You can do this by typing adduser username with username being the desired name for the website's user. After you set the password you can login as the user and create a directory such as www and a basic index.html file.

As root, go to /etc/apache2/sites-available then create a file called Enter the following into the file:
NameVirtualHost *
DocumentRoot /home/username/www/

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

Replace all occurrences of mydomain, username, and www, with the relevant real values and save the file. Then in /etc/apache2/sites-enabled type:
rm 000-default
ln -s ../sites-available/
/etc/init.d/apache2 reload

Now try in a web browser and you should see the contents of index.html. The first line of rm 000-default is only needed to remove the default Ubuntu Apache virtual host entry for new sites you add to your server it is not required.

For those with dynamic websites that need database access, check out Slicehost's article on creating MySQL users.

1 comments: said...

Great tutorial!

I tried this tutorial and ran into just a few problems I thought I would mention.

Before running the apt-get commands, make sure to run apt-get update and apt-get upgrade (pretty common knowledge, but some may not know)

In the virtual host section I had to change a few things to get it working on my Linode.

<virtualhost> changed to <virtualhost *>
<document> changed to <document />

without those changes, or specifying directories apache will fail to reload.

Thanks again for the tutorial!

Post a Comment