If you’ve already decided to go for a VPS and setup everything, then get ready and follow the step by step instructions available here in this guide to setup a fully functional, high performance and secured web server. This guide will assume you are using linode as the VPS provider. The procedure will be almost similar in other providers too. So lets start:
Goto linode signup and start setting up your linode.
- Visit the Sign Up webpage and create a new account
- Once you’ve signed in, enter your billing and account information. Most accounts are activated instantly, but some accounts require manual review prior to activation. If your account is not immediately activated, please check your email for additional instructions.
- Select a Linode plan and data center location, as shown below. The data center location should be the nearest physical location to most of your userbase.
Once you’ve selected the datacenter, then you’ll be prompted to deploy a linux distribution to it:
There are many distributions available, but I prefer ubuntu 14.04 as it is an LTS (Long term support) version and will provide security and feature updates for more long time than other ubuntu distributions and I like ubuntu as it is known to be the most successful linux distribution. So if you are in harmony with my choices then select the
Ubuntu 14.04 LTS.
If you don’t plan to test other distributions then leave the deployment disk size to maximum value. Then select the swap disk size which is the amount of disk space to be used as swap memory when your ram is full. For most people 256MB will be fine. Then you need to write a root password with which you’ll login to your remote server. Choose a strong password with a combination of letters and numbers. Because your server might have to face brute-force dictionary attacks by hackers. And a good password is the key to prevent such attacks. You’ll also need automated intrusion detection system to protect your server from malicious attackers to make it a smart and secured server later. For now let’s be strict to the basics.
Now you can Click “Rebuild” and watch the installation progress in your dashboard. After completion of the jobs you can now start your linode server clicking the “Boot” button.
Once your server has booted you can login to it using ssh as user root.
To remote login via ssh, you need to know the ip-address of your linode. Click the “Remote Access” tab in the Linode Manager. Then copy the ssh access command from there and paste into your terminal.
If your own computer is running on MacOSX or Linux then you can use terminal and use the ssh command you've just copied. If you are in Windows then you may want to use Putty for ssh login.
If a warning something like this below appears, type
yes and press Enter to continue connecting.
The authenticity of host '123.456.78.90 (123.456.78.90)' can't be established. RSA key fingerprint is 11:eb:57:f3:a5:c3:e0:77:47:c4:15:3a:3c:df:6c:d2. Are you sure you want to continue connecting (yes/no)?
The log in prompt appears, as shown below. Enter the password you created for the root user.
Note that this prompt will not print the password you type. So you just type your password and press Enter.
After you’ve successfully logged into the server, the very first thing you’ll do is to install the necessary security updates. To do that type the following commands and execute them.
sudo apt-get update sudo apt-get upgrade --show-upgraded
Set the HostName
You’ll need to set your system’s hostname and
FQDN (fully qualified domain name). Your hostname should be something unique. Please note that the system’s hostname has no relationship to websites or email services hosted on it, aside from providing a name for the system itself. To set the hostname use the following commands replacing
codinglogs with the hostname of your choice:
echo "codinglogs" > /etc/hostname hostname -F /etc/hostname
Now, open your
/etc/hosts file for editing by issuing the following command:
The file will be opened using the
vi editor. Please note that a server operating system generally do not contain User Interfaces like desktop operating systems. So you'll have to edit files using command line editors like
vi in your terminal.
Now type the letter
i to start editing the file. Now add the following lines if not already exists:
127.0.0.1 localhost.localdomain localhost 18.104.22.168 codinglogs.example.com codinglogs
Don't forget to replace
codinglogs with your chosen hostname,
example.com with your primary domain name, and
22.214.171.124 with your system’s IP address in the above command.
Now press the
ESC key and then type : followed by x like this
:x and hit enter. This will save the changes to the file you opened with vi editor and return to the terminal. For some reason if you don’t want to save the changes then type
:q! and hit enter to exit from vi editor. If you are not familiar with the vi editor then for now just remember to press
i to start editing and then press
ESC to end editing and use cursor keys to move the cursor and edit the file and then type either
:q! to exit the editor.
Setting the Timezone
You can change your Linode’s timezone to whatever you want it to be. It may be best to set it to the same timezone of most of your users. If you’re unsure which timezone would be best, consider using universal coordinated time or UTC.
Enter the following command to access the timezone utility:
Etc/UTC if you want to serve global traffic. Otherwise set it to the local timezone of your users.
Checking the Time
Now try entering the following command to view the current date and time according to your server:
Good work! Now you have an up-to-date Linode running in the data center of your choice. Next, you’ll need to secure your Linode and protect it from unauthorized access. Let's move to the next article: Securing Your Ubuntu VPS Server