Learn to set up your new VPS server in 5 steps

Taking the step from one to one is a relatively easy movement, and we explain everything about how to do it. However, learning how to set up a VPS from scratch can be a bit trickier, especially if you’ve never used the command line before.

In this article, we will explain how to set up a vps in five steps:

  1. Learn how to login to your VPS through Secure Shell (SSH) access.
  2. Update your server.
  3. Create a new user and modify their privileges.
  4. Enable public key authentication.
  5. Configure a firewall for your VPS.

However, before we get into the technical details, let’s explain why you’ll need to set up your new virtual server. Let’s talk about how to set up a VPS!

Why you should set up your new VPS

Typically, when you sign up for a basic hosting plan, your provider will set up all the necessary software to use it. For example, with shared hosting, you’ll probably get access to a control panel for your account right away:

These hosting control panels give you all the options you need to set up your account. However, in most cases, you won’t have the opportunity to modify your server settings, since other users are also using the same machine.

On the other hand, you get a server environment all to yourself, this is what makes it perfect for applications like . However, in most cases, your hosting provider will only be limited to setting up basic server software, such as Apache or Nginx, and the rest is up to you. That means you’ll probably need to take a few extra steps to get your server “ready”, like:

  • Decide when you should start using a VPS.
  • Learn to connect and issue commands.
  • Find out how to install new software and perform updates.
  • Set up new user accounts (if necessary).
  • Configure a firewall.

When we talk about issuing commands to your server, we mean something like this:

Typically, you will be interacting with your VPS using the command line instead of a . That can be intimidating at first, but you’ll quickly get used to it if you don’t mind googling the right commands and following some simple tutorials.

Also you may set up hosting control panels that will allow you to interact with the server using a graphical user interface. However, we’re not going to cover that part in this article, as using the command line is often the most efficient route. Also, learning how to use simple commands will teach you a lot about server administration, which is sure to come in handy as your site grows.

5 steps to configure your new VPS and have it ready to use

As you may know, the vast majority of web servers run on Unix-based systems. That means you’ll need to use commands tailored to that type of operating system (OS), which aren’t the same as you’d use on a Windows machine. If you want to learn more about managing Windows servers, for more details.

See also  What is the WordPress database? All you need to know

With that part cleared up, let’s talk about setting up a VPS!

Step 1: Learn how to login to your VPS through Secure Shell (SSH) access

There are several ways to connect to a website other than using a web browser. For example, you can use the , which allows you to upload, download and edit files on your server:

While FTP can be very useful, it does not allow you to issue commands to your server. For that, you will have to use the , which is a different type of protocol that gives you access to remote servers.

Once you connect to a server via SSH, you will be able to issue commands. SSH is also known for its strong encryption and authentication protocols, which make it highly secure. By learning to use SSH, you will be taking your first steps in server administration.

Once , your web hosting provider must provide you with a set of credentials, including:

  • The IP address of your server
  • A username (usually root)
  • A password for your account root

In case you are not familiar with the term, an account root (either Super user) is a user with full privileges and access on a specific system. You can think of it as the equivalent of an administrator, but with even more power.

When you set up a VPS, you will start with a single account root, which you will use to establish the initial connection. If you are using a Unix-based operating system on your local machine, you can connect to your server directly from the command line.

However, if you’re using Windows, you’ll need to install an SSH client first. We are supporters of two clients in particular, the first is called:

If you are looking for a simple interface that resembles the classic Windows style, you will go for the sticky one with Bitvise. However, most of the work will be done within the command line, so style doesn’t matter much.

We’re also big fans of , which has a much more minimalistic interface. However, it does offer a lot of additional configuration options, so it’s preferable if you really want to go deep into server administration.

For the rest of this tutorial, we will use PuTTY in our examples. With that in mind, and then run it. You will see a window like this:

At this point, you must enter the IP address of your server in the field host name (either IP addresses), and leave the settings Port in the default value of 22:

Aside from SSH connections, port 22 is also used for secure logins and Secure File Transfer Protocol (SFTP).

See also  Introducing the Referral Program

You may notice that there is an option to select which type of connection you want to use below the IP field. Choose SSHand then you can press the button Open.

It will open and you will see a prompt to enter your login information. In this case, it will be root and its corresponding password:

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

That’s it for the first step of how to set up a VPS. However, don’t close the command line window, as we still have work to do.

Step 2: Update your server

Once you log in to your VPS, you will see a message indicating if there are any ‘packages’ or security updates available:

Packages are essentially software in Unix parlance. When it comes to any system, it’s always important to keep its components up to date, and servers are no exception.

If you use outdated software, you are exposing your server (and your website) to security vulnerabilities. Also, you may be missing out on new features or better performance. That’s why the first thing you’ll want to do is update your server packages and download any pending security patches.

To get started, type the command apt update and press Enter. Now your server will check which packages need to be updated. Once this is done, write apt dist-upgradewhich will update your server packages:

This process may take a while, depending on how many updates your server needs to install. So sit back, have some coffee, and wait for me to finish.

Once all the packages are up to date, you need to restart the server with the command reboot. Then close the command line window. Wait a minute or two and log back in using putty (or the client of your choice).

If everything went according to plan, there should be no more updates available in the list. That means we can move on to the next step of learning how to set up a VPS.

Step 3: Create a new user and modify their privileges

When you set up a VPS, you start with one user root , which is the account you’ve been using so far. However, it is generally a good idea to set up another user account with superuser privileges.

The reason is that the account root it can cause serious damage if you’re not sure what you’re doing. One account root it has full access to all your system settings, so a single wrong command can create serious problems.

A normal user account with superuser privileges, on the other hand, needs to add the prefix sudo to any command you want to run using administrative privileges. This may seem like a small change, but it makes a big difference. With this approach, you should think twice before running any commands prefixed with sudowhich can help you avoid inconveniences.

See also  28 products to sell that are trending in 2022

Now set up that new user by entering the following command. Replace the second part with the username you want to use:

adduser newusername

Then write this line to add that user to the group sudowhich will give you superuser privileges (again, replacing the last part with your new username):

# usermod -aG sudo newusername

Now, it only remains for us to create a password for this account. However, there is a method that is much more secure than using a normal password, which is what we will see next.

Step 4: Enable public key authentication

The is a technique that is possibly more secure than normal passwords. With this approach, you generate a set of both ‘public’ and ‘private’ keys.

Your server will store your public key and use it to authenticate your private key, which only you will have access to as a file on your computer. Once you set up public key authentication, you’ll need both your private key and a passphrase to log in, which significantly increases security.

To generate SSH keys on Windows, you can use , which will have been installed when you set up the client earlier (for information on how to do this on Linux/Unix systems, see this guide). Browse through your programs and run the PuTTYgen application now, which should look like this:

It’s ok to use the default settings for your key pair, so click the button Generate. To make your key more unique, the program will ask you to move your mouse to make it a more random key, which is pretty cool:

Next, the program will show you the public key it generated for you. Before you do anything else, set up an accompanying passphrase, which will act as a password for the key:

Now press the button Save private key (Save private key) and save the resulting file to your computer. You’ll also need to copy your public key in a bit, so don’t close this window yet.

Then log back into your server with the user root original and go to the home directory of your new account using # su – newusername. The command line will now reflect your new user:

After that, you will need to execute a series of commands in order, which…

Loading Facebook Comments ...
Loading Disqus Comments ...