Once you have your Linode box set up with your favorite Linux distribution and you have setup your web server and mySQL server you are ready to put your actual Drupal site online. This Drupal on Linode tutorial will walk you through exactly how you do this. Soon I will have a few up to date writeups on how to setup your Linode box and install a Linux distro but for now you can check out this somewhat out to date tutorial. If you follow it up until the part of installing your Drupal site then you can pick up here.
So here's what I have currently at this point. A Linode box with Ubuntu installed on it. I also have mySQL set up on it and Apache 2 with PHP 5. If you have something different you can probably still follow along with this article but some of your paths might be a little different.
Setup Virtual Aliases
By default your main site will be located at /var/www/. If you put a file there called index.htm and add some test HTML page to it you will see it when you navigate to http://www.yoursite.com. If all you want is a single website you can simply install your drupal to this directory (/var/www/). However, I highly discourage this. Even if right now you only have a single site I recommend you set it up as a virtual alias so that later if you want to add more sites they are all organized. However, this is a matter of preference.
If you do want to setup virtual aliases you can simply create a sub-directory under your /var/www/ area. For instance for this site I created a /var/www/linodereview.com/ directory. Along with this I created two subdirectories under it called web and called logs. This way I can keep my webpages in the web area and I can tell Apache to log this sites info into my log directory. If you don't tell Apache this it will log all of your sites into the same logfile (/var/log/apache2/).
In a little bit we will place all our Drupal files into our /var/www/sitename.com/web/ area but for now just create an index.html file there and put a line it that says: TESTING THIS or something like that. Once you have that file in place we need to tell Apache that we have our virtual site ready. To do that navigate over to /etc/apache2/. You will notice that their are a few files and directories here. One important file is the apache2.conf file. This file has many, many Apache settings in it and if you aren't using Ubuntu you may need to edit this file to setup your web aliases. However, with Ubuntu Apache is already set up to automatically look in the sites-available and sites-enabled folder to handle aliases. sites-available is where we will configure our virtual alias so navigate into this directory.
You probably will only see on file in this folder. It is your default site information. Lets create a config file for our new site (nano sitename.com.conf). Add these lines to it:
I'll quickly explain what these do. First it tells Apache where our files are located. Next it tells Apache what our website will be called (both the .com site and the www.com site). The CustomLog and ErrorLog lines are a little bit of cleverness. It tells Apache to pipe all our log info through rotatelogs. This will cause our logs to be timestamped and broke out everyday. Note you do not have to do this. If you just want all the data put directly into the logs you can change those lines to this:
CustomLog "/var/www/website.com/logs/website.com.access.log" combined ErrorLog /var/www/website.com/logs/website.com.error.log
Once you have setup this config file save it and close out. Now you will need to enable this site. This will tell Apache to serve the files. To do this you can run the simple command: a2ensite website.com.conf. Then tell Apache to reload its config files so it picks up the changes.
/etc/init.d/apache2 reload
Now if you go to your site you will see your TESTING THIS text. NOTE: You will have to setup your DNS to have this work. If you are not sure how to do this you can use Linodes DNS manager. It makes it pretty easy. Ask on the Linode IRC chat or search there forum to find out how.
Installing Drupal
Now to install Drupal all you need to do is navigate back over to your /var/www/website.com/web/ directory. Delete the index.html you created and copy your Drupal files over. If you are setting up a new install all you need to do is run these commands:
wget http://ftp.drupal.org/files/projects/drupal-6.4.tar.gz tar xvzf drupal-6.4.tar.gz cp -r drupal-6.4/* . rm -r drupal-6.4 rm drupal-6.4.tar.gz
Here is what each of these lines do. The first downloads Drupal (note you should check the Drupal site and make sure you get the latest version). The next line unpacks everything into the drupal-6.4 directory. The next line copies all of the files from this the drupal-6.4 directory into our web directory. The last two lines remove the old files.
Now that we have this uncompressed and setup and since Drupal 6 has a handy installer all you need to do is navigate to http://www.yoursite.com and begin setting things up.
Clean URLs
Before you start setting up Drupal if you want clean URLs (which I highly recommend) you need to enable mod_rewrite for Apache. To do this you want to run the command a2enmod rewrite. Again you will want to reload Apache after this: /etc/init.d/apache2 reload. Now when you setup Drupal you can have clean URLs enabled. Note: If you already installed Drupal you can still enable Clean URLS. Just setup Apache like described above and then navigate to Administer -> Site Configuration -> Clean URLs in Drupal and set it up.
Now have fun. When you need to add more sites simply set them up the same way described above. You can easily host several small sites even on the lowest Linode 360 plan. If you outgrow that plan you can simply upgrade and it will all work the same. I've done this many times.
If you don't already have Linode account you can sign up for one and get up to 15% off!