5 Steps | Make a Virtual Private Server (VPS)

Moving from shared hosting to a Virtual Private Server (VPS) is a straightforward step. However, learning how to set up a VPS can be more challenging, especially if you’ve never used the command line before.

In this article, we’re going to walk you through how to set up a VPS in five steps:

Before we can discuss the technical details, though, we’ll tell you why you need to set up your new virtual server. Let’s talk about setting up a VPS!

Why You Should Configure Your New VPS

Providers typically provide clients signing up for a typical hosting plan all of the equipment they’ll need to use it.

These server control panels give you all the tools you need to configure your account. However, other accounts might also be configured on the same equipment, so you may not be able to change any of the settings.

With a Private Server Account, on the other hand, you maintain complete control over your server environment. In most cases, your web host will install only a basic server package, such as Apache or Nginx, and you are responsible for configuring the rest. Also, you may want to install a control panel like Cyberpanel for easier management.

When we talk about issuing commands to your server, we’re referring to something like this:

Typically, you will interact with your virtual private server (VPS) using the command line rather than through a graphical user interface (GUI). This may be difficult at first, but you’ll soon get used to the more straightforward commands if you follow some basic tutorials.

You can also set up hosting control panels that will help you communicate with your server using a GUI. However, we’re not going to cover that in this article, since using the command line is often the faster route. In addition, you can learn a lot by learning how to use simple commands. This will be useful as your site grows.

5 Steps to Configure Your New VPS and Get It Ready to Use

As you may know, most web servers run on Unix-based systems. For that reason, you’ll need commands designed for that system type, which are different from those you’d use on a Windows machine. To learn more about Windows server management, read the guide that follows.

Now that that’s out of the way, let’s discuss how to set up a virtual private server (VPS)!

Step 1: Learn How to Log into Your VPS via Secure Shell (SSH) Access

There are many ways to access a website, beyond using a browser.

While File Transfer Protocol (FTP) can be useful, the configuration doesn’t allow you to give commands to the server. For that reason, you must use Secure Shell (SSH) access, which is another type of protocol that grants you access to remote servers.

If you connect to a server through SSH, you are able to issue commands to it. SSH is incredibly popular for its strong encryption and authentication protocols, which make it extremely secure. By learning how to use SSH, you’ll take the first step towards server management.

When you sign up for a VPS plan, your web host should give you with a list of credentials, including:

If you’re not familiar with the term, a root or super-user account is a user with full privileges and access on a system. You can think of it like an administrator, but with even more power.

When you set up a VPS, you’ll begin with one root account, which is the one you will utilize to initially connect to your server. If you’re using a Unix-based operating system on your hard drive, you can directly connect the server from the command line.

However, if you are using Windows, you’ll need to install an SSH client.

If you’re looking for a straightforward interface that is reminiscent of the classic Windows style, you can’t go wrong with Bitvise. However, most of the work you will do will be done in the command line, so the style doesn’t matter much.

Our favorite terminal is PuTTY, which has a simplified interface. However, it has many extra configuration options, making it better for users who want to try their toes into server management.

For the remainder of this lesson, we will be using PuTTY in our examples. Therefore, go ahead and install the program, and then run it.

At this stage, you need to enter your server’s IP address into the Host Name (or IP address) field, and leave the Port setting to the default value of 22:

In addition to secure SSH connections, port 22 is also utilized for secure logins and Secure File Transfer Protocol (SFTP). You can also change the SSH port if you wish.

You can notice that there is a box to select which connection type to use beneath the IP address field. Select SSH, and then press the Open button.

A command line window will appear now, and you will be asked to enter your login information.

If the data entered is correct, you’ll see a brief summary of your server’s details, and a prompt to enter more commands:

The completed setup of a VPS is the next step in the process. Do not close the command prompt window, though. We still have more to do.

Step 2: Update Your Server

Once you log into your VPS, you’ll see a message that tells you if there are any ‘packages’ or security updates available:

Packages are essentially programs in Unix-speak. Servers must be kept up-to-date at all times, and packages are no exception.

If you are using outdated software, you open your server (and website) to security vulnerabilities. In addition, you may be missing new features or improved performance. That’s why one of the first things you should do is update your server’s packages, and install any pending security updates.

To begin, enter the appropriate update command and hit Enter. Now, your server will examine which packages require updating.

This task might take a while, depending on the number of updates your server needs to install. So sit back and relax, grab a cup of coffee, and wait for it to finish.

After your packages are updated, you need to reboot your server by running the reboot command. Afterward, close the command line window. Wait a few minutes and log in again using PuTTY (or your client of choice).

If the internship went smoothly, there should be no more available updates listed. Thus, we can continue to the next step of learning how to set up a virtual private server.

Step 3: Create a New User and Modify Its Privileges

When you set up a virtual private server (VPS), you start with a root user, which is the account you’ve been using up to now. However, it is often a good idea to set up another user with superuser privileges.

The reason is that the root account can cause damage to your system if you are not careful. A root account has access to all of your system’s settings, meaning one incorrect command could cause major problems.

An ordinary user account with superuser privileges, on the other hand, should add the sudo prefix to any action it wishes to perform with administrative powers. This may seem like a minor change, but it makes a huge difference. With this setup, it’s important to be careful when using the sudo prefix, as this could help you avoid mistakes.

Enter the following command to set up the new movie user.

add yournewusername to .

Therefore, type in this line of code to add it to the sudo group, giving it superuser privileges (again, replacing the placeholder with your new username).

#usermod -aG sudo yournewusername

Now, all that’s left to do is to set up a password for this website. However, there’s a better way to maintain security than using a standard password, which is what we’ll be discussing next.

Step 4: Enable Public Key Authentication

Public key authentication is a technique that’s more secure than standard passwords. With this method, you create a set of both ‘public’ and ‘private’ keys.

Your server will hold your private key and use it to authenticate the public key, which only you can access as a file. In order to use public key authentication, you will need the private key along with a passphrase. This method is far more secure than using a username-password combination.

You can ask the PuTTYgen app to generate SSH keys in Windows. The PuTTYgen app was installed when you installed the client earlier (for information about how to do this on Unix and Linux systems, see this guide).

You can feel free to use the default settings for your key phrase pair, so you can click on the Generate button now.

The program will then show you the public key it created for you.

Now, click the Save private key button, and save the file to your desktop. You will also need to copy your public key within a moment, so you should do not close this window just yet.

Then, log back into your server with the original root user, and move to your new account’s home folder using

After that, you’ll need to run a series of commands in order, which will create a new folder for your public key, restrict that folder’s permissions, and save your key:

The last command will provide you with access to the Nano editor, which will enable you to modify the new authorized_keys file on your server. Go ahead and copy your public key from the PuTTYgen window and paste it here.

Once the main is complete, press CTRL + X to close the editor and type Y when asked to confirm the changes.

These will revoke the new permissions for the document you edited, and then return you to the unadjusted user.

Next, set up PuTTY to use your private key when accessing your server. To do so, return to the app’s main screen and go to the Connection › SSH › Auth section.

Select the Browse button, and then select the private key file you saved on your computer. Select it, and the file will open.

You must also inform your server to disable the password-required login method for your newly enabled user.

This will open the sshd_config file using the Nano editor. Look for the passwordAuthentication line in that file and delete the # symbol in front of it.

Save the changes to the file, and reboot your server. The next time you log in to the server, you will only be able to do so by entering your private key and passphrase.

Step 5: Set Up a Firewall for Your VPS

There are still a few steps left to take if you want your server to remain secure. That is to allow a firewall for it.

You can use the iptables program to restrict traffic to and from your server. This is an extremely involved procedure, however, so check out our complete guide on how to set up iptables to set up the program correctly.

This step may seem superfluous at first. With Iptables, you can determine which ports allow traffic to enter your server. This will limit the number of incursions in their tracks. It’s a onetime setup procedure, so the sooner it’s done, the more money- and time-saving it is.

How to change the hostname on linux servers.
Tmux is a network streaming tool that allows users to stream audio and video to any number of devices. It can be used to create task lists and upload videos to YouTube.
How to install FFmpeg on Linux
how to install and use Linux screen

Conclusion

It is like leaving the kiddie pool to dive into an Olympic-sized pool after upgrading from shared hosting. You have more space and functionality to play with, but you must find your footing first before you start having fun. To set up your VPS, you are familiar with the command line, which will enable you to configure everything to your liking.

Leave a Reply

Your email address will not be published. Required fields are marked *