A Virtual Private Server (VPS) is essentially the better choice when you compare it with a dedicated and shared server. Why? Because cost-wise, VPS costs are lower than dedicated servers, and security or performance-wise, VPS is better than a shared server. But let’s address the elephant in the room now. If you are new to using a VPS, it’s normal to ask yourself “How to set up a VPS?â€.
This article takes you through a step-by-step guide to setting up your VPS.
Key Takeaways
- A VPS is similar to dual web hosting. It combines aspects of dedicated and shared hosting.
- Self-managed servers are preferable for individuals with previous server configuration, security, and maintenance experience and who do not need the assistance of the web hosting company.
- Your host will just set up the most fundamental server software leaving the rest up to you.
- You will need to choose the right time to use VPS, master the connection process and send commands, figure out how to update and install new software, create fresh user accounts, and establish a firewall.
What is VPS Hosting?
Let’s understand what VPS is first. VPS is a virtual server that acts as a physical server.
VPS concept is built on top of the virtualization technology. So there is a parent server on which we create several virtual servers using the virtualization technology. Each of these virtual servers have their own operating systems and resources dedicated to them. VPS systems can be built either on a single server or over a collection of servers.
VPS hosting comes in two types: Managed and Self-Managed.
When you get a managed server, your hosting provider company installs all the necessary software for your website. They also update and configure your website. This makes it easy for you to just run your website smoothly.
Self-managed server, as the name suggests, is when the user has all the control of the VPS. This means the user has to install all the software and specifics on their own but also have complete server access, including the server’s internals. Furthermore, unlike managed VPS, self-managed VPS has root access.
When should you know about self-managed VPS hosting?
With a self-managed VPS, you, the server user, are responsible for all support. Self-managed servers are preferable for individuals with previous server configuration, security, and maintenance experience and who do not need the assistance of the web hosting company. Hosting companies would simply guarantee the self-managed VPS has electricity and internet access.
In addition to the self-managed duties, you would be forced to use a third-party server consulting company or engage a systems administrator to maintain your server if you were unable to do so yourself. The costs of just doing that would probably be higher than just starting with a fully-managed VPS. If this doesn’t sound like something you’re looking for, try a managed VPS plan instead
Why you should configure your new VPS
Most of the time, your provider will install all the software you’ll need to use whenever you sign up for a basic hosting package. This might also come with a hosting control panel. You have every feature you need to configure your account in these hosting control panels. However, because other users are also utilizing the same machine, you won’t typically have the opportunity to change your server’s actual settings.
VPS, however, gives you exclusive access to a server environment. Most of the time, your host will just set up the most fundamental server software leaving the rest up to you.
As a result, you’ll likely need to take a few more steps to “prepare†your server. This can include choosing the right time to use VPS, mastering the connection process and sending commands, figuring out how to update and install new software, creating fresh user accounts, and establishing a firewall.
Additionally, you can build up hosting control panels that will let you communicate with your server via a graphical user interface. Mastering basic commands will educate you a lot about server administration, which will undoubtedly be helpful as your website expands.
How can your VPS hosting provider help?
You have complete control over your server while using a self-managed VPS. Only the network connection and the virtualization platform that houses your server will be provided by the hosting company.
Everything else, including server setup, configurations, upkeep, upgrades, and software installation, is your responsibility. Therefore, it is important to make sure you are familiar with the server software and operating system you intend to employ before selecting a self-managed VPS.
Setting up your VPS – Step-by-step
Instead of a graphical user interface, you will typically use the command line to communicate with your VPS. The sound of it can be frightening, but this article will make sure you fully understand how to set up your VPS with step-by-step instructions.
Step 1: Connect to a VPS through Secure Shell (SSH)
You can connect to your VPS using a variety of communication protocols. For example, you can use the FTP protocol to upload files to the server. However, you need SSH protocol if you want to properly configure your VPS.
SSH is a network protocol that lets you create an encrypted connection to your VPS using which you can issue commands to the server.
If your device runs a Unix-based operating system, you can connect via the Terminal. SSH only functions through a command-line interface.
You can issue commands to a server once you’ve established an SSH connection. SSH is popular for its powerful authentication and encryption algorithms, which make it extremely safe.
The hosting company should give you a set of credentials whenever you register for a VPS plan. This includes a username (root) and password.
When you set up a VPS, you’ll have just one root account, which is what you’ll use to connect to the server if it is your first time. You can immediately connect to your server from the command line if your operating system is Unix.
But if you are a Windows user, you will need other software to work with SSH. We would recommend using PuTTY.
At this point, you must enter the IP address of your server in the Host Name (or IP address) field and leave the Port setting at 22.
There is a choice of the connection type you want to use in the PuTTY interface. Select SSH, and then click the Open button to continue.
The request will be received by the server over port 22, which will then identify the username (which is often “rootâ€) and request your password. Once you have given the accurate login details, a welcome message will appear on your CLI as shown below.
You’ve successfully entered your self-managed VPS.
Step 2: Update your server
Keep in mind that you are accountable for both the security of the projects hosted on the server as well as its proper operation. A significant component of this is keeping your VPS updated, as doing so ensures that almost all security fixes are up to date.
If any security updates are available, you’ll notice a message when you connect to your VPS. Start by entering the apt update command and pressing Enter.
Your server will now confirm which packages require an upgrade. Once it’s finished, run apt upgrade to update the packages on your server.
Once all of your packages are up to date, you should use the reboot command to restart your server, then close the command line window. Wait a few seconds, then log in again using your client software, in our case, PuTTY.
There shouldn’t be any more accessible updates if it was successful.
Do note that these commands vary from one Linux distribution to another. For instance, CentOS and RHEL use the command yum check-update
or dnf check-update
Step 3: Set up a new user
You’ve been interacting with the server’s root user up to this point.
In Linux, the root user essentially serves as the system’s owner. Whenever you are in as root, there is unrestricted access to the server, and you may pretty much do whatever you want.
On the other hand, an ordinary user account with the privileges of a superuser needs the sudo prefix before any command it wants to run with administrative rights. Although it can look like a small adjustment, it has a significant impact.
You can use adduser [new username]
to set up the new user.
The server will request a password for the new account as well as a few other information from you. You can then assign the new user account to the sudo group using the usermod -aG sudo [new username]
command. This gives the user superuser privileges.
You can end the SSH session that is running and log in using the new user account to make sure everything is functioning as it should.
Step 4: Use an SSH key to authenticate
It’s best to strengthen your authentication method to block specific attacks.
If you choose a strong password, the conventional user/pass method is frequently effective. However, SSH can authenticate individual users using a public-and-private key pair, which is an even more secure configuration.
You must first create the SSH key to utilize it. This is simple to accomplish in Windows because of the PuTTYgen program included with the well-known SSH client. Click Generate after opening the app. A public key and a private key will be created by PuTTYgen.
The top box, which contains the public key, may be seen. Before moving on, you must also choose a passphrase that will serve as both a password and a key pair. To save the key to your computer, click Save Private Key.
To save the public key, return to the server as the root user and type in su - [username]
.
You must first establish the folder where your public key will be stored and configure the permissions so that you can create the file there. To do that, type in the following:
mkdir ~/.ssh chmod 700 ~/.ssh nano ~/.ssh/authorized_keys
The command with the nano prefix will launch a program called Nano editor. This text editor allows you to edit the server’s key files. Copy your public key from the PuTTYgen window and paste it instead of authorized_keys right away.
Open the SSH settings and navigate to Connection > SSH > Auth to utilize the pair of keys and log in through PuTTY to your account. To pick your private key and save the modifications, use the “Private Key File for Authentication†option.
Disabling password authentication for your account is the only thing left to do. You must modify the etc/ssh/sshd_config SSH configuration file to accomplish that by switching the value of PasswordAuthentication from Yes to No.
Step 5: Set up a Firewall
The most crucial security feature for hosting servers is a firewall. It must monitor outgoing and incoming traffic and make sure that only people with the proper access may access the data.
The majority of Linux distributions utilize the iptables firewall to manage traffic both to and from the server. It’s typically available by default. To establish the firewall rules, you can, however, use a variety of programs with different distributions.
For instance, UFW, the standard firewall configuration tool in Ubuntu, and Firewalld, in CentOS, are comparables. All of these tools are designed to make the process of configuring iptables simpler.
They operate differently, and they don’t share the same syntax. You must consult the OS documentation to understand how they operate.
Conclusion
A self-managed VPS cannot simply be configured and left alone because you are responsible for making sure the machine operates as efficiently as possible.However, If you put effort into it, you can operate a VPS easily. There is plenty of useful information that will tell you what to do and point you on the correct path.
Choose a top-notch managed VPS option if operating a virtual server is something that is not in your area of interest or skill and leave it to the experts.
But, how do you know how to choose one? Try HostAdvice to get expert advice and customer reviews on the Best VPS hosting plans that you can choose from.
Further Reading
- How to Choose a VPS Provider that Suits Your Needs
- What Is A VPS Used For? Top 10 VPS Use Cases in 2022
- VPS vs. Shared Hosting: Head-to-Head Comparison
- VPS vs Dedicated Server: Which Hosting Should You Use?
- Types of VPS: Do You Know Which VPS You Need?
Frequently Asked Questions (FAQs)
1. What is self-managed VPS?
Similar to a shared hosting package, the provider of a managed VPS takes care of all technical matters. You should configure and operate entirely when using a self-managed service. In this case, the host’s only duty is to maintain the hardware and network’s functionality.
2. Compared to shared hosting, is VPS hosting faster?
The answer is that a VPS plan is faster than a shared hosting plan. You have resources and space set aside just for your website, which is the reason. However, in shared hosting, resources and storage are distributed across all of the server members as the name implies.
3. What distinguishes shared hosting from dedicated hosting?
The entire server is devoted to one client in dedicated hosting, which can be quite expensive. In shared hosting, a server and all of its resources, including its CPU, storage, RAM, and so forth, are shared by several clients. Although it is less expensive than dedicated hosting, the drawback is that if the other site experiences a spike in traffic, your resources will suffer.
4. What are VPS hosting’s major benefits?
Speed, security, higher uptime, scalability, customization, and root access are a few benefits of VPS hosting.