Setting up a vps with cheapvps.co.uk [part1]

So, I’ve got my freshly setup VPS. My OS of choice is currently Ubuntu - not because it’s better than any other mainstream distribution but there’s lot’s of good documentation out there for Ubuntu and if you stick to one distribution you get to know it perculiarites. Some of the commands listed below will only work with Ubuntu so if you’re using something else you may need to look round for the equivalant commands.


First job is to update and secure things and make sure everything looks like it’s running OK.

We need a ssh client for accessing the system (a secure version of telnet). Personally I use putty - http://www.chiark.greenend.org.uk/~sgtatham/putty/

Log in as root using the ip address and password supplied by your VPS provider.

Running the following command should tell you what release of Ubuntu you’re currently on

cat /etc/lsb-release | grep 'DISTRIB_CODENAME'| cut -d= -f2 | awk '{ print $1}'
feisty

So I’m running feisty (7.04) which I might as well upgrade to Gutsy Gibbon as there’s nothing on the machine to break. Before I start that though, I’m going to run the top command to see what the system is doing. This command will show you the cpu and memory utilization for your vps

top
top - 19:33:04 up 27 min, 1 user, load average: 1.00, 0.99, 0.81
Tasks: 34 total, 3 running, 31 sleeping, 0 stopped, 0 zombie
Cpu(s):100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 131244k total, 46444k used, 84800k free, 3356k buffers
Swap: 0k total, 0k used, 0k free, 28712k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
222 root 25 0 2620 396 204 R 99.9 0.3 27:29.06 nash-hotplug
1 root 15 0 1956 672 572 S 0.0 0.5 0:00.00 init
2 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
7 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
9 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenwatch
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenbus
16 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/0
17 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0
21 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
23 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod
77 root 25 0 0 0 0 S 0.0 0.0 0:00.00 pdflush
78 root 15 0 0 0 0 S 0.0 0.0 0:00.00 pdflush
79 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kswapd0

So, for some reason my vps is running nash-hotplug and this is utilizing 99.9% of the CPU. This definitely isn’t normal (I’ve reported it to cheapvps who are going to tidy up the template) so let’s kill that off and prevent it from running next time we reboot.

/usr/bin/killall nash-hotplug
echo "/usr/bin/killall nash-hotplug" > /etc/rc.local

If you run the top command now you should see 0% cpu utilization

Now to setup the repositories for Gutsy Gibbon

cp /etc/apt/sources.list /etc/apt/sources.list.orig
echo "deb http://us.archive.ubuntu.com/ubuntu gutsy main restricted" > /etc/apt/sources.list
echo "deb-src http://us.archive.ubuntu.com/ubuntu gutsy main restricted" >> /etc/apt/sources.list
echo "deb http://security.ubuntu.com/ubuntu gutsy-security main restricted" >> /etc/apt/sources.list
echo "deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted" >> /etc/apt/sources.list
echo "deb http://us.archive.ubuntu.com/ubuntu gutsy-updates main restricted" >> /etc/apt/sources.list       
echo "deb-src http://us.archive.ubuntu.com/ubuntu gutsy-updates main restricted" >> /etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu gutsy universe multiverse" >> /etc/apt/sources.list
echo "deb-src http://archive.ubuntu.com/ubuntu gutsy universe multiverse" >> /etc/apt/sources.list

Now to update the repositories

[My vps needed a reboot here - not really sure why but DNS wouldn't resolve. Could have been because of nash-hotplug running?]

apt-get update -y

If you get GPG errors you may have to run the following 2 commands

apt-get install gnupg -y --force-yes
apt-get install ubuntu-keyring -y --force-yes

Then run the update again

apt-get update -y

Hopefully you will not get the errors this time

Now we can upgrade to Gutsy Gibbon (7.10) by running the following

apt-get upgrade -y

This may ask you a question about upgrading PAM and restarting services - you can click OK to this

A few packages apt wasn’t sure about upgradig for us so let’s do it manually

apt-get install apt dmsetup libblkid1 libpam-modules netbase netkit-ping syslinux -y

Everything should be upgraded now but you can check by running

apt-get upgrade

Now reboot to make sure everything is updated

reboot

Login back in and head to part2 for securing the vps


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 -

Securing my Ubuntu VPS [part2]

Installing Mysql and Apache [part3]

Installing WordPress on a VPS [part4]

My VPS was from cheapvps.co.uk 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




Related posts:

  1. Securing my Ubuntu VPS [part2]
  2. Installing WordPress on a VPS [part4]
  3. Installing Mysql and Apache [part3]


Leave a comment