How to setup your first VPS – linode – PART 1

linode

linode

For this example, we’ll be setting up a VPS with with awesome folks at Linode lets begin! Once we are past the account setup stuff, this guide will help you setup a VPS with any provider.

Select a plan

Select a plan

Select a plan, fill in the form, hand over your credit card details and submit! Within a few minutes you’ll receive an account activation. Using your login username and password, log into your control panel @ www.linode.com.

Click on deploy distro

For this example we’ll be spinning up a Centos 32bit distro, no need to make any other changes, just slot in your password. Once the image has been installed you’ll see this screen.

Click on the boot button.

Click on the network tab to find your ip address, we’ll need this to ssh into your new VPS to complete the setup process. Your IP is located ext to the heading eth0: in our case this is 173.255.216.68

On your local machine open up a terminal window (or download Putty if your are on Windows)

login

login

In your terminal type (replace 100.100.100.100 with your ip address)

ssh [email protected]

You may then be asked to authenticate your hosts RSA fingerprint, type YES  and hit enter.

Now you’ll be asked for your password, enter it and hit return.

Well done, you’ve made it into your new VPS! We’ll start doing a bit of house work to get your VPS up to scratch, first we’ll see if there are any updates that need to be installed, CENTOS has a package manager called YUM. To execute the update type this:

yum update

YUM will work out which packages need to be downloaded and present you a list that looks like this:

Yum UPDATE

Yum UPDATE

Hit y and then return and watch your system get updated.

The next thing to do is to remove ROOT access to your server, this is basic security 101, we will disable the user ROOT’s ability to log into our server via SSH, instead we’ll create another user with the name ‘superdude’ (you can pick whatever name you like, but try and avoid generic names like admin etc etc) whilst we are in this process we’ll also install a program called denyhosts which will monitor our system for illegal login attempts and ban people that are trying to access our machine.

adduser

adduser

useradd superdude
passwd superdude

Type in your new password, you’ll notice i typed in a common word found in a dictionary which CENTOS rejected, make sure your password is STRONG, this means alphanumeric combinations greater than 7 characters and also add in at least one special character like [email protected]#$%^&*()><.

Now lets install denyhosts, to do this we must install the RPM repo like this.

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm

Install the GPG key

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

Verify the package

rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm

Install RPMFORGE

rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm

Now run yum Check.

yum check-update

Now lets install denyhosts with the following command.

yum -y install denyhosts

the default settings are ok, but if you want to customise your settings you need to edit this file

nano /etc/denyhosts/denyhosts.cfg

Now lets turn on the daemon so that it runs 24/7

chkconfig denyhosts on
service denyhosts start

Now lets turn off ROOT login access edit:

nano /etc/ssh/sshd_config

Find this section:

# Authentication:
#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

And modify to look like this:

# Authentication:
LoginGraceTime 2m
PermitRootLogin no
StrictModes yes
MaxAuthTries 6

Now lets restart sshd

/etc/init.d/sshd restart

Now the next time you SSH into your server you will need to log in with user superdude, however you won’t have root access until you log in as super user, to do this, you’ll need to execute

su -

followed by your ROOT PASSWORD

In our next edition we’ll setup the webserver/mysql/php

Comments are closed.