To make sure a website is always online, there is a need for its files to be uploaded online via a web server acquired from a web hosting provider.
The act of hosting the website resources on the internet is known as web hosting.
Hosting a website using a VPS is normally employed by those who have outgrown shared hosting. Shared hosting is a type of web hosting that allowed multiple sites to be hosted on a single web server. All the websites on the server share all available resources.
Contrarily , VPS hosting allows a smaller number of users to share the available hosting resources like memory space, Hard Drive space, and processor power.
Every client on the VPS server has direct access to a virtual machine that executes its OS. This feature allows each customer on the VPS to enjoy parallel capabilities and performance on their websites.
Can You Host Your Website On A VPS?
Virtual Private Server hosting, called VPS hosting, is a tool that gives you access to resources that are devoted to hosting your website on a shared server.
Hosting your website using a VPS is partly shared and partly dedicated. One of the many ways of hosting your website online is by using a VPS.
VPS hosting is the most preferred of shared hosting and hosting on dedicated servers for these reasons;
- When it comes to resiliency, performance and availability, VPS hosting wins and
- VPS hosting is by far cheaper compared to a fully dedicated setting inside a shared server.
That said, Virtual Private Server (VPS) hosting has become a trendy alternative because it's relatively cheaper compared to hosting on a dedicated server aside from providing enhanced dependability, protection, and performance than its dedicated counterpart.
How much RAM do I need for VPS Hosting?
Right now, you are just a step away from submitting a VPS hosting order form, and you're staring at different offers that seem confusing. Any of these can influence your final decision; the Disk Space, the CPU or the RAM. So which will it be?
For the record, the RAM size is one important thing you can't overlook when choosing a VPS for hosting a website.
How Do You Determine How Much RAM You Need In VPS Hosting?
Generally, there is no straight answer to the question. Meanwhile, the size of the RAM depends on what you're installing on your server. Another factor influencing the RAM size in a VPS is the number of requests the server can handle, which implies the expected site audience's population per time.
But quickly look at what you would be installing.
How Do You Host A VPS Inside Your House?
It is very easy to move from a shared hosting service to a VPS hosting service. But one thing you must do correctly is know how to set it up, most importantly if you are a novice in writing and executing command prompts.
Let me quickly teach you how to do it like a pro in five quick steps!
- Learning how to access your VPS using Secure Shell (SSH) protocol.
- Keeping your server up-to-date.
- Generating a new user id and modifying its rights.
- Enabling public key verification.
- Implementing a firewall on your VPS.
It is no longer news that the vast majority of web servers operate on Unix OS. What this translates to is that you'll only have to use customized commands that work only on that type of OS, which is completely different from Windows OS that you are probably used to.
Want to know more about managing Windows servers? This guide will put you through.
With that out of the way, let's get to know how to launch a VPS!
Learning How To Access Your VPS Using Secure Shell (SSH) Protocol
Aside from using a browser, there are other ways of getting connected to your website. One of those ways includes using FTP (File Transfer Protocol). File Transfer Protocol allows you to upload, download and format the files on your server.
Though FTP has proven useful in accessing websites, the protocol doesn't permit you to send whichevercommand to your web server. In other to bypass that, you have to use what we call Secure Shell (SSH) access, another protocol that permits the accessibility of servers remotely.
As soon as you're connected to your web server through SSH, you can now launch whichevercommand you want on the server.
The Secure Shell (SSH) is well known for its powerful encryption and verification protocols, making it highly protected. Once you understand how to use SSH, you're ready to activate the first server management step.
So, after signing up for a VPS plan, you will be provided with a set of credentials by your web hosting service provider. Some of the credentials you will be getting from your VPS vendor include;
- IP Address of your Server
- A username (typically for root account)
- Root Account Password
The term root account, also known as a superuser account, is a type of account with complete rights and privileged access to a particular system.
You might be confusing this with an admin account, but trust me, the root account is powerful than that.
After setting up a VPS, you ready to begin with just one root account; that is the one you will be using to make the first connection. If you are executening a Unix-based OS server, you can directly connect with your web server from the command prompt.
Meanwhile, it is very important to install an SSH client if you are executening on a Windows-based server. At this point, we will be using two clients, the first of which is called Bitvise.
Bitvise gives you a simple interface that looked like the typical Windows mode. With Bitvise, you can't ever go wrong. Meanwhile, most of your work will be done from the command prompt, which means that the style means nothing much.
Secondly, I love PuTTY so much because it has some features with an additional interface. The only thing about using PuTTY is that it has many additional configuration options, which gives you an edge if you want to go in-depth into server management.
So, we will be focusing on using PuTTY in our examples as we advance. Haven said that let's set the ball rolling and install the software, after which we'll launch it.
From the PuTTy SSH client window, enter your server's IP address into the Host Name/ IP address section. Leave the default Port value setting value as 22
Apart from using port 22 for connecting SSH, it is also used to secure login details and the SFTP (Secure File Transfer Protocol).
You would have observed an option to choose the connection type you love to use under the IP Address field. Opt for SSH, and then go ahead and press the Open icon.
You will see a window with a command-line. You will also be prompted to enter your login details, but you will be entering the root account details and their related password.
If you input invalid data, a summary of your server's details will pop up, and you will be prompted to enter additional commands.
Bravo! You have completed the first step in configuring a VPS.
Please wait for a second! Don’t close that command window yet because you still have something else to do on it.
Keeping Your Server Up-To-Date
After you've been logged on to your VPS, a message informing you of any packge or security update will pop up.
Once you log into your VPS, you'll see a message that tells you if there are any 'packages' or security updates available:
No matter the type of system you are using, it is very pertinent to keep every one of its components and the servers updated.
Executening outdated software can make your server vulnerable to security bridges, and this can make you miss out on new features that can bring enhanced performance. So, don't hesitate to keep your server's packages up to date and also make sure you upgrade any imminent security patches.
To get started, input the apt update command and press enter. This will make your server to double-check all that need an upgrade in your packages. After that, input apt dist-upgrade to also get your server's packages updated.
How long this will take depends on the number of updates required by your server. So you might need to relax with a cup of coffee while this lasts.
Fater the complete update is completed, go ahead and restart your server using the restart command, after which you can exit the command window and wait for one or two minutes to log in back using either PuTTY or any of your preferred client.
If done properly, you wouldn't e prompted to do any update again. Then we can proceed to the next step!
Generating A New User ID and Modifying Its Rights.
When configuring a VPS, you begin as a root user. Meanwhile, the best thing to do is create another user account with superuser rights because if you don't do this, the root account can cause great havoc if you're still confused as to what you are doing. The root account has complete access to your system's settings meaning that any wrong execution of command can lead to serious problems.
Contrarily , creating another user account with super user rights is needed to insert the sudo prefix to whichever command the account wishes to execute using the admin rights. This change might seem small, but with a huge impact.
So think twice when using this method to execute whichever command using the sudo prefix, which helps you eliminate potential mishaps.
Use the following command line # usermod -aG sudo yournewusername to set up a new user but replace the second part with your desired username.
After this, the only thing remaining is to create a password for this new account. Nonetheless, a more secure way of doing this will be unveiled in the next step.
Enabling Public-Key Validation
This is a method that is a technique that's perhaps more protected than the standard passwords. Using this approach, you will generate a set of 'public' and 'private' keys.
Your server will make use of the public key to validate the private key, which only has access to one of your computer's files. After setting up the public key validation, the private key and a passphrase will be needed to log in, this is another security layer.
You can make use of the PuTTYgen app, which would have been installed on your system when configuring the client to create SSH keys in Windows. Click here for a detailed guide on how to do this.
You can find the PuTTYgen app among the programs that have been installed. Once you find it, execute it now!
There is nothing bad in using the default settings to generate your keys. No waiting, do it now! You will be prompted to mouse your mouse randomly to make the key more distinctive.
The generated public key will be displayed on the system, but doing anything else will create an accompanied passphrase, which will act as a password together with the key. Ensure you save the key and the passphrase on your system.
But wait! Don't close the window just yet because you may have to copy and use the public key in a moment.
Now, log in back to your server using the default root user and then to your new account's home index using # su – your new username.
This command line will now show your new user.
Now, execute several new users to create a new folder for your public key bot. Don't forget to restrict that folder's permissions before you save the key.
That most recent command will launch the Nano editor, allowing you to adjust the new authorized_keys file on your server.
Go back to the PuTTYgen window, copy your public key now, and paste it here.
Then hit the combination of CTRL + X to close the editor, and hit Y on the keyboard when prompted to confirm the file's changes.
Then, input in the following two-line commands:
chmod 600 ~/.ssh/authorized_keys
The commands will change the permissions for the file you just edited and then go back to the root user.
The next thing to do is to configure PuTTY to use your generated private key whenever you're connecting to your server so that it can recognize that it's you.
To do this, return to the app's main screen and look for the 'Connection › SSH › Auth' section, where you will find a section called Private key file for validation.
Click the Browse Icon, and move the private key file stored on your system and select it.
That's it! You're good to go.
As you conclude, command the server to disable the default password, use only the authentication method to access the new user account you just created. All you need to do to do that is log on to your server as the new user using SSH and execute the command below;
sudo nano /etc/ssh/sshd_config
This command will open the sshd_config file via the Nano editor.
Look for the line that says Password Authentication in the file, and remove the # sign before the line and change its value from Yes to No, so that you see this;
Save the changes and restart your server. When you attempt to log in, you'll only be able to log in with your private key and passphrase.
Let's go to the last step!
Implementing a firewall on your VPS
So far, we have covered that larger part of configuring a VPS for web hosting. In this last step, we will be keeping your server secured from any form of cyber attack. To achieve this, we will be setting up a firewall around your server.
Setting up a firewall on your server can be done using a program called iptables. This program will permit you to set up rules that limit the traffic sent and received from your server.
This process is a bit wide, so we recommend that you check the recommended full guide in doing this properly by clicking here.
In the beginning, this step may look too burdensome, but with Iptables, you'll be able to limit which ports permit traffic to access your web server. Doing this will stop many attacks on your server.
Besides, this is a one-time setup procedure, so it is advantageous to do it now!
Nearly all website owners started with shared hosting for their websites, but as time goes on and as their website withness more traffic, which most time demand additional resources and functions, there is always a need for a more potent hosting option; that is where VPS hosting comes handy.
Generally, a virtual private server (VPS) is regarded as the stepping stone from a shared hosting plan to a dedicated hosting system where your website executes on its server.
Learn more :