Linode VPS setup
Server Adminstration, Updates April 22nd, 2009It took me about 2hrs to setup the server, from signin up to linode to transferring and bringing up this site.
Just thought i could list down the steps, so that it could be helpful for someone else and may be to myself later
.
I used articles by Victor Kane and Jeff Beeman as a guidance for setting up the server. (Links to their articles can be found in the references list).
Signup & steps performed in Linode Manager
Signed up for Linode 360. Before signing up searched for coupon code in google but could only get some expired ones
.
Immediately after signup, I just logged into the Member’s area or Linode Manager. It asked me to select the geographical location of the server. They have 4 different options
- Newark, NJ, USA
- Atlanta, GA, USA
- Dallas, TX, USA
- Fremont, CA, USA
I selected Fremont, CA, USA, as its closer to India, among the above four.
The Member’s area is very user friendly. I have used Slicehost earlier, but linode has better Membership area. Why Linode? Wait for few more days to see my views on why I prefered Linode over Slicehost.
Linode Distro Wizard.
Linode has Distro Wizard to assist setting up the server.
The first step is to select the OS and they have a big list of options to select from. I decide to select latest version of Ubuntu as I’m used to the Ubuntu environment. They had two options Ubuntu 8.10 – 64bit and Ubuntu 8.10 – 32 bit. Skimming through the Linode community, I found that there is no real advantage using 64bit unless there is specific requirement. So, I selected Ubuntu 8.10 32bit.
Selecting Disk Image and Swap Image size
Now next step is to select the disk space and swap space. I selected 512swap space and used remaining space to create image. The Linode 360 plan comes with 12GB disk space and I dont really expect to run out of space at least in the near future, so decide to have swap space little larger. Then typed in the root password and created the image.
The image was ready in about 15secs and I logged into the server using ip which is available in the network tab in the Member’s area.
Steps performed in server console
I logged into the server using SSH from my Linux machine.
update & upgrade
Now I did apt-get update and upgrade.
apt-get update
apt-get upgrade
At this stage I got lots of warnings like
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = (unset)
are supported and installed on your system.
I generally don’t ignore warnings, but since the upgrade was successful, I just ignored it.
Setting hostname
/bin/hostname tamilg.in
echo tamilg.in > /etc/hostname
Be careful! The second line has /etc/ not /bin/
I just overlooked this and end up corrupting the /bin/hostname file. lol….. I couldn’t find a way to restore the corrupt file. Also, ubuntu.com or any of its mirror doesn’t seem to have files in extracted state. They just has the iso image !? Not sure!. I had little time and so deleted the whole image from Member’s area and reinstalled everything. This time I was careful! – don’t repeat mistakes
)
Should the hostname necessarily be a valid domain name!? Yes, says Wikipedia – Hostname.
Now a rebooted the server from the Member’s area. Just had to click a “Reboot” button.
Installing Vim – Vi Imporved.
Vi editor comes with default Ubuntu installation. But I’m used to Vi Imporved and its really difficult to use basic Vi editor if you are not used to it. I used
apt-get install vim
Now again got those warning message but this time installation failed!!! So, I had to fix the warnings now! I fixed it after 2hours of struggle as I couldn’t find the proper solution to fix this.
The issue was because the folder/usr/lib/locale/ doesn’t had the needed language files. Users in some forums suggested to do
locale-gen
dpkg-reconfigure locales
apt-get install –reinstall language-pack-en
But those weren’t sufficient to fix the issue. Finally fixed the issue by adding a symbolic link to language file.
cd /usr/lib/locale
sudo ln -s es_ES.utf8 es_ES
Now used apt-get install vim and the installation was successful.
Installing Apache, MySQL and PHP
I just followed the instruction of Jeff Beeman.
# Apache2
apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert
# MySQL
apt-get install mysql-server mysql-client libmysqlclient15-dev
It asked if I want to set password for root user and I typed in the one easier for me to remember!
# PHP
apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Now restarted the apache server using the command
apache2ctl restart
Installing sendmail and configuring PHP to use it for sending mails
apt-get install sendmail
Opened /etc/php5/apache2/php.ini and updated the sendmail path.
sendmail_path = /usr/sbin/sendmail -i -t
Subversion and Apache modules
I use subversion for version control of my project, however small they be. So, I installed it in the server.
apt-get install subversion
Enabled deflate, expires and cache modules for Apache2. These modules are necessary to get the site better optimized for performance and learnt it from the usage of YSlow Firefox plugin to optimize Snesclassics.com. I’m the server administrator for the site snesclassics.com. If not now in future these module could be handy and so I decide to enable them.
a2enmod deflate
a2enmod expires
a2enmod cache
Now basic setup is complete and the server is ready to go live!!!. (I’m yet to configure the firewall and secure the server, just hoping that no one would waste their time hacking a nearly empty server
).
Setting up site(s) in server
My site was down from 6th April 09. The site was hosted in Dreamhost (shared) account of BambeeQ.
Updating DNS to serve tamilg.in from Linode
Now I added tamilg.in from DNS Manager tab of Linode Manager – Add a new domain zone. Then updated the nameserver of the domain in my domain registrar admin page to
ns1.linode.com & ns2.linode.com
I waited for about an hour for DNS propagation. Mean while I added the Virtualhost in the server.
Adding Virtualhost
The general practice is to put the sites in folder /var/www/.
But I used to a different practice(from the usage of slicehost). i.e. Using a separate user for hosting sites and having the sites in /home/<website user>/public_html/
I created user websites for this purpose. The directory structure for the site tamilg.in is
/home/websites/public_html/tamilg.in/
../tamilg.in/
|-/public/
|-/private/
|-/backup/
|-/logs/
The folder names should clearly suggest their usage. For testing created a simple index.php file under /home/websites/public_html/tamilg.in/public/.
Now, created the file tamilg.in under /etc/apache2/sites-available/
Content of tamilg.in & is self explanatory.
<VirtualHost *:80> # Admin email, Server Name (domain name) and any aliases ServerAdmin tamil@bambeeq.com ServerName www.tamilg.in ServerAlias tamilg.in ScriptAlias /cgi-bin/ /home/websites/public_html/tamilg.in/cgi-bin/ # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /home/websites/public_html/tamilg.in/public/ # Custom log file locations ErrorLog /home/websites/public_html/tamilg.in/logs/error.log CustomLog /home/websites/public_html/tamilg.in/logs/access.log combined </VirtualHost>
Now that virtual host settings are ready, enable the site tamilg.in using the command
a2ensite tamilg.in
restart the apache server
apache2ctl restart
Initally I didn’t get the test page when I viewed http://tamilg.in/. The reason was the delay in DNS propagation.
After sometime, I got the test page loaded!!! Hurry!!!
Yet to do!
I got the site running from my Linode instance, but still there are few things left for me to do asap. I’m yet to secure the server by setting up firewall and have to disable root login to the server.
What next?
Then I installed WordPress and setup this site!
. So, that gives me subject for the next post!
Huge post! I hope should be useful!!!
References:
- Google Google Google!!! Find anything you want
– Google - Victor Kane’s – VPS! Getting Drupal up and running on a linode
- Jeff Beeman’s – Just got rolling with a VPS on Linode (Part 1)
You may also Subscribe to feeds via feedburner.


May 24th, 2009 at 8:35 pm
[...] month and setup this site myself. The steps to setup the server can be found in previous article – Linode VPS setup. I feel like setting up few days back but actually a month has gone by. Time is running so [...]
June 15th, 2009 at 6:50 am
Thank you very much for you tutorial! You see, I am green on Linux.
I’ve followed your steps and set up the VPS.
But I can’t figure out how to add virtualhost.
Also how to set firewall to my vps
At last, why I can’t send mails?
Hopefully you can help me.
Greatly appreciate!
June 15th, 2009 at 10:01 am
Hi Kevin,
You can directly add vitualhost entry to /etc/apache2/httpd.conf (not recommended) or add vitualhost entry for the domain by creating a file in the folder /etc/apache2/sites-available/ as explained above.
I will publish another post about setting up firewall soon.