When businesses grow over time, hosting requirements also increase. Websites attract more traffic, and shared hosting plans fail to pick the load. Despite knowing that the VPS Server UK is the best way out, people hesitate because even the thought of running an entire server on their own scares them.
This article will be a complete and comprehensive guide for the configuration of your VPS servers.
VPS Server: What Can You Expect?
VPS Hosting offers your own virtual machine to handle your websites. Dedicated resources and zero sharing results in the best performance. However, server management is something you never do when on the shared hosting plan.
You can change your environment and tweak your server settings in VPS plans. However, the most your provider will do is set up the server software.
6 Easy Steps to Configure VPS Server
After pointing out the right resources, your hosting provider may leave the rest to you. That may involve dealing with the command line, but we are here to explain the process in easy steps.
So let us begin the journey. The procedure that works for Linux may not work on any other operating system. This guide is written for Linux.
Access The Server: Use Secure Shell
Secure Shell or SSH is the network protocol. It has two basic functions. Number one is making an encrypted connection with a server. Number two is executing the execute commands on it. The proper configuration of VPS requires SSH. SSH requires you to use a command-line interface for operation.
So use the login credentials provided by your host to access the server via SSH. Here is the command you will use for it.
ssh [root username]@[server IP]
A server should show you a welcome message. If it does not, you have not entered the correct login details. If it does, congratulate yourself. You have logged in to your server.
Now Update Your VPS Server UK
Not just performance, but security is also your responsibility. That makes updating your major responsibility because updates also install new security features and patches. Only then do you have the secure VPS server.
The command for CentOS and RHEL will be as follows:
yum check-update or DNF check-update
You will type ‘apt update’, when you will be using Ubuntu and other Debian-based instructions.
These commands will instruct the operating system to traverse the software packages and find the ones that are outdated.
The command is ‘apt upgrade’, if the distro underuse is Debian-based. You will have to type ‘yum update’ or ‘DNF update’ if the operating system is RHEL or CentOS. When the update is done, use the reboot command to restart the server.
Create A New User For Better Maintenance
We worked as the root user who could do almost anything until this point. The root user is the owner. But we know that minor mistakes can lead to severe damages, so a second account with superuser admissions would be a great strategy. Let us explore how it is a good strategy.
The second will also allow you to change the most critical settings of the server. However, if you cannot execute the command without administrator authority, you must add the sudo prefix.
It is not a minor change. Error messages that ask you to add a prefix will provoke you to rethink what you are doing. This way, you can be more cautious.
Execute this command to create a new user:
adduser [the new user’s username]
You will be asked to select the password by the server. Then comes assigning a new user account to the correct user group. The following command will do this:
usermod -aG sudo [the new user’s username]
It is good to cross-check everything. If you want to make sure things work correctly, finish this SSH login session, and come back with a new user account.
The Default SSH Port Is LoopHole: Change It
If you are familiar with SSH, you must know which is the default listening port. It is Port 22. The users of SSH know it but so do the cybercriminals. Strong passwords do reduce the risks but do not eliminate them.
So what do you have to change? The answer is the SSH default listening port. And what do you have to edit for this? The answer is the SSH configuration file. However, take a backup first for safety and then start editing. Here is how your editing goes. First, you type the following command:
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_old
Nano is a text editor based on the command line. Nano will help you edit SSH configuration files. The following is the path for it.
Find the line that says, ‘#Port 22’. First of all, remove #. Now replace 22 with any number that falls between 1024 and 65535. Make sure you do not forget it. Next time you log in, you will need it.
Applying changes is not possible if you do not save the SSH configuration files. So save it immediately. Now use the following command to restart the service:
systemctl restart ssh
Some commands may require sudo prefixes if you are not logged in with a root account.
Generate the SSH Keys for Your VPS Server
Many automated scripts prowl over the internet and attempt to hack your servers. Changing the default listening port of SSH will make you safe from the scripts.
However, when it comes to blocking the targeted attacks, you should arrange for the best authentication mechanism.
So we need a pair of Public and private keys. It is the SSH tool that helps it authenticate individual users. Although a regular password system is also enough, provided that the password is strong.
However, you first come to the step of SSH keys generation. Open the app PuTTYgen, and click the button that says generate. It is a famous SSH client.
The top corner will show you the public key. A passphrase to serve as a password and work along the keypair is also mandatory.
Saving the key on your computer is important. Click on the ‘Save Private Key’ button. Now, the public key will be our focus.
Now, become a root user again, and log in again as this status. Then, use the following command to open your account’s home directory.
su – [your username]
Hereafter, you have to create a folder. This folder will do two things. First, it will host your public key. Second, it will set the permissions so you can make a file inside it.
Use the following commands for it:
chmod 700 ~/.ssh
We already have the public key that PuTTYgen created for us in the previous steps. Now comes the stage of creating a file where you paste this public key: This time again, we will use Nano text editor.
Now you should be able to use keypair for connecting your account with PuTTY. Here is the procedure for this. Open SSH client settings, and go to connection using Connection > SSH > Auth.
The next step is the selection of the private key. The private key file from the authentication field will help you do that.
Save changes before proceeding. Now disable the password authentication of your account.
That requires you to edit the SSH configuration file etc/ssh/sshd_config. It is just like the value of your PasswordAuthentication is Yes, and switch it to No.
Firewall Is Your First Line of Defense
Being the most critical security setting, the firewall checks both entering and leaving traffic. The firewall also makes sure no unauthorized person accesses the data. A professional VPS hosting in the UK is not possible without a firewall configuration.
The name of the firewall that major Linux distros use is iptables. It filters the traffic from the server. The majority of distros will give you pre pre-installed firewall. For the configuration of firewall rules, many utilities are available.
UFW is the default firewall of Ubuntu, and CentOS is the one of CentOS. This is because they make the configuration of iptables easy.
None of their syntax and mechanisms is the same. You’ll need to go through your OS documentation to figure out how they work.
The Final Verdict
We hope that this guide helps you configure your VPS servers easily. If you are looking for VPS hosting, TheEmailShop offers VPS servers at affordable rates. Your best VPS Server UK could be one step away.
For Discount and Offers Visit our Official Twitter Page