I recently signed up for Rackspace’s next generation Cloud Servers powered by OpenStack. The new control panel is clean, easy to use, and it gives live feedback as your servers are being built, creating an image, changing the root password, etc. Today I’ll go over the steps I performed to get Node.js v0.82 running on an Ubuntu 12.04 image.
You’ll need a Rackspace Servers account. Optionally, you can also apply for the limited availability program
of the next generation Cloud Servers if you want to kick the tires of OpenStack. Using the control panel you can create a new server. I picked the Ubuntu 12.04 LTS and this article will be geared towards that.
After you’ve created the server make sure to change the root/admin password for your image. This is easy with the control panel:
I then followed one of the Rackspace articles to do some initial (basic) security lockdowns on the new server. Please keep in mind there is much more you can do to secure your server so I suggest you investigate it further.
Using the IP for your new server you can SSH into it. I then proceeded to add a new user and changed the password (you can actually do this in one command):
$ useradd -s/bin/shell -d/home/yourusername -m yourusername $ passwd youusername
From here I added myself to the list of sudoers:
$ visudo
Look for this line in the file:
root ALL=(ALL:ALL) ALL
Add this right below it:
yourusername ALL=(ALL:ALL) ALL
Press the key combination Ctrl-X to exit and then press “Y” to save and hit enter.
Note: Make sure to use common sense and security best practices, giving yourself full root access is really no different than using the root user which is obviously a no-no.
Follow the steps on Rackspace’s guide to create public and private keys. Once you’ve done that make sure to also modify the SSH configuration to change the port SSH runs on as well as to disable the ability to log in using a username/password. If however you will need to log in via username/password from numerous computers then you can ignore the last part.
$ nano /etc/ssh/sshd_config
Example: change the port to 27111
I then setup some simple rules for the firewall (iptables) as well as to route requests to port 80 to port 8080.
$ sudo iptables -I INPUT 1 -p tcp --dport 27111 -j ACCEPT iptables $ sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT $ sudo iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT $ sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 $ sudo iptables -P INPUT DROP $ sudo sh -c "iptables-save > /etc/iptables.rules" $ sudo iptables -L
Edit the following so the above iptables changes are not lost on a reboot:
$ sudo nano /etc/network/interfaces
Under the this line: iface lo inet loopback
Add the following:
pre-up iptables-restore < /etc/iptables.rules
If everything went well then restart the SSH service now.
$ sudo service ssh restart
Log back into your server and follow these steps to install Node.js:
Note: Make sure your comfortable installing packages from this third party site BEFORE performing the steps below.
$ sudo apt-get update $ sudo apt-get install python-software-properties $ sudo apt-add-repository ppa:chris-lea/node.js $ sudo apt-get update $ sudo apt-get install nodejs npm
Assuming everything went well try out Node.js and NPM:
$ node -v $ npm -v
Expected output (assuming node version 0.82 and NPM version 1.1.36):
v0.8.2 1.1.36





