Mar 18, 2022
Will M .
5 Steps to Get Your New Virtual Private Server (VPS) Ready to Use
Making the jumpstart from shared host to a virtual Private Server ( VPS ) is a relatively easy move. however, learning how to set up a VPS can be a act crafty, particularly if you ’ ve never used the instruction pipeline before.
Download Complete Linux Cheat Sheet
In this article, we ’ re going to walk you through how to set up a VPS in five steps :
- Learning how to log into your VPS via Secure Shell (SSH) access.
- Updating your server.
- Creating a new user and modifying its privileges.
- Enabling public key authentication.
- Setting up a firewall for your VPS.
Before we get into the technical details, though, we ’ rhenium going to explain why you ’ ll need to configure your new virtual server. Let ’ s lecture about how to set up a VPS !
- Why You Should Configure Your New VPS
- 5 Steps to Configure Your New VPS and Get It Ready to Use
Why You Should Configure Your New VPS
normally, when you sign up for a basic host plan, your provider will set up all the software you ’ ll need to use it. With divided host, for example, you ’ ll credibly get access to a command panel for your account right off :
These hosting control panels provide you with all the options you need to configure your explanation. however, in most cases, you won ’ deoxythymidine monophosphate get the gamble to tweak your server ’ second actual settings, because other people are besides using the same car .
With a VPS, on the other hand, you get a waiter environment all to yourself. In most cases, your host will only go then far as to set up basic server software – such as Apache or Nginx – and the lie is up to you. That means you ’ ll probably need to go through a few extra steps to get your waiter ‘ ready ’, such as :
- Deciding when should you start using VPS.
- Learning how to connect to it and issue commands.
- Figuring out how to install new software and perform updates.
- Configuring new user accounts (if needed).
- Setting up a firewall.
When we talk about issuing commands to your waiter, we ’ re referring to something like this :
normally, you ’ ll interact with your VPS using the command line alternatively of a Graphical User Interface ( GUI ). That can be intimidating at beginning, but you ’ ll promptly get used to it if you don ’ triiodothyronine beware Googling around for the right commands and following some dim-witted tutorials .
You can besides set up hosting control panels that will enable you to interact with your server using a GUI. however, we ’ re not going to cover that in this article, since using the control line is much the more efficient road. Plus, learning how to use simple commands will teach you a draw about server management, which will about surely come in handy as your locate grows .
5 Steps to Configure Your New VPS and Get It Ready to Use
As you may know, the huge majority of web servers run on Unix-based systems. That means you ’ ll want to use commands tailored to that type of operating System ( OS ), which are not the same as those you ’ vitamin d use on a Windows machine. If you want to learn more about Windows server management, check out this guide for more details .
With that out of the way, let ’ s lecture about how to set up a VPS !
Step 1: Learn How to Log into Your VPS via Secure Shell (SSH) Access
There are respective ways you can connect to a web site, beyond using a browser. For exercise, you can use File Transfer Protocol ( FTP ), which enables you to upload, download, and edit files on your server :
While FTP can be identical useful, the protocol doesn ’ thyroxine enable you to issue commands to your server. For that, you ’ ll indigence to use Secure Shell ( SSH ) access, which is a different type of protocol that provides you with access to remote servers .
once you connect to a server via SSH, you ’ ll be able to issue commands to it. SSH is besides renown for its hard encoding and authentication protocols, which make it highly procure. By learning how to use SSH, you ’ ll be taking your first steps into server management .
once you sign up for a VPS plan, your web host should provide you with a stage set of credentials, including :
- Your server’s IP address
- A username (usually root)
- A password for your root account
In lawsuit you ’ re not familiar with the terminus, a root ( or superuser ) bill is a drug user with full privileges and entree on a particular organization. You can think of it as the equivalent of an administrator, but with even more might .
When you set up a VPS, you ’ ll start off with a single root score, which is the one you ’ ll consumption to make the initial connection. If you ’ re using a Unix-based OS on your end, you can connect to your server directly from the command cable .
however, if you ’ re using Windows, you ’ ll first need to install an SSH node. We ’ rhenium partial to two clients in particular, the beginning of which is called Bitvise :
If you ’ rhenium looking for a childlike interface that resembles the classic Windows stylus, you can ’ thyroxine go wrong with Bitvise. however, you ’ ll be doing most of your work within the command lineage, so the manner doesn ’ t matter much .
We ’ re besides big fans of PuTTY, which features a far more minimal interface. however, it offers a set of extra shape options, making it preferable if you truly want to dip your toes into server management .
For the remainder of this tutorial, we ’ rhenium going to be using PuTTY in our examples. With that in mind, go ahead and install the platform, and then execute it. You ’ ll see a window like this one :
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 option value of 22 :
aside from SSH connections, larboard 22 is besides used for plug logins and Secure File Transfer Protocol ( SFTP ). You can besides change the SSH port if you like .
You may notice that there ’ s an option to select which connection character you want to use below the IP field. Choose SSH, and then you can go ahead and hit the Open push button .
A dominate line window will open nowadays, and you ’ ll see a prompt to enter your login information. In this case, that will be root and its equate password :
If the data entered is correct, you ’ ll see a brief summary of your server ’ mho details, and a prompt to enter more commands :
That ’ s it for the beginning pace of how to set up a VPS. Don ’ t near the command channel window so far, however, since we still have work to do .
once you log into your VPS, you ’ ll see a message that tells you if there are any ‘ packages ’ or security system updates available :
Packages are basically software in Unix-speak. When it comes to any system, it ’ second constantly crucial to keep its components up to date, and servers are no exception .
If you ’ re using outdated software, you open up your waiter ( and web site ) to security vulnerabilities. Plus, you might be missing out on raw features or improved performance. That ’ south why the first thing you ’ ll want to do is update your server ’ s packages, and download any pending security patches .
To get started, type in the apt update command and hit Enter. now, your server will double-check what packages need upgrading. Once it ’ sulfur done, enter apt upgrade, which will update your server ’ randomness packages :
This procedure might take a while, depending on how many updates your server needs to install. So baby-sit rear, grab some coffee, and wait for it to be done .
once all your packages are up to date, you should go ahead and restart your server using the reboot command. then, close the command line window. Wait a moment or two, and log back in using PuTTY ( or your node of option ).
If everything went according to plan, there shouldn ’ t be any more available updates listed. That means we can move on to the following step of learning how to set up a VPS .
Step 3: Create a New User and Modify Its Privileges
When you set up a VPS, you start off with a root drug user, which is the account you ’ ve been using therefore far. however, it ’ mho normally a good estimate to set up another drug user report with superuser privileges .
The reason for this is that the root account can cause some austere damage if you ’ re not surely what you ’ re doing. A root account has broad access to all of your system ’ s settings, so one faulty control can create dangerous problems .
A regular drug user account with superuser privileges, on the other hand, needs to add the sudo prefix to any control it wishes to run using administrative privileges. This may seem like a minor change, but it makes a huge difference. With this approach, you ’ ll need to think doubly earlier running any command using the sudo prefix, which can help you avoid mishaps .
Go ahead and set up that newly drug user immediately by entering the follow command. You ’ ll want to replace the second function with whatever username you ’ d like to use :
then, type in this credit line to add that drug user to the sudo group, which will give it superuser privileges ( again, replacing the placeholder with your new username ) :
# usermod -aG sudo yournewusername
nowadays, all that ’ randomness left is to set up a password for this report. however, there ’ s a method acting that ’ s far more secure than using a normal password, which is what we ’ ll attend at future .
Step 4: Enable Public Key Authentication
Public key authentication is a technique that ’ s arguably more impregnable than regular passwords. With this approach, you generate a located of both ‘ public ’ and ‘ individual ’ keys .
Your server will store your public key and use it to authenticate the private one, which merely you will have access to as a file on your computer. once you set up populace key authentication, you ’ ll need both the private key and a passphrase to log in, which increases security significantly .
To generate SSH keys in Windows, you can use the PuTTYgen app, which will have been installed when you set up the customer earlier ( for details about how to do this on Linux/Unix systems, check out this guide ). Look among your programs for it and run the PuTTYgen app now, which should look like this :
It ’ second fine to use the default option settings for your key pair, so go ahead and click on the Generate button nowadays. To make your key more singular, the program will ask you to move your mouse around to randomize it, which is reasonably cool :
next, the plan will show you the populace key it generated for you. Before you do anything else, go ahead and set up an accompanying passphrase for it, which will act as a password alongside the key :
now, go ahead and hit the Save private key button, and save the resulting file to your calculator. You ’ ll besides need to copy your public key in a moment, so wear ’ metric ton close this windowpane just yet .
then, log back into your waiter using the original root exploiter, and move to your new account ’ s home directory using # su – yournewusername. The control tune will immediately reflect your new exploiter :
After that, you ’ ll motivation to run a series of commands in order, which will create a newfangled folder for your populace key, restrict that folder ’ second permissions, and save your key :
mkdir ~/.ssh chmod 700 ~/.ssh nano ~/.ssh/authorized_keys
That last command will open up the Nano editor program, enabling you to modify the new authorized_keys file on your server. Go ahead and copy your populace key immediately from the PuTTYgen window, and spread it in here .
once the key is fix, score CTRL + X to close the editor program, and embark Y when it asks you to confirm the changes to the file. then, type in the following two commands :
chmod 600 ~/.ssh/authorized_keys exit
Those will change the permissions for the file you merely edited, and then return you to the root exploiter .
future, you ’ ll motivation to configure PuTTY to use your secret key when you connect to your server so that it can recognize you. To do this, refund to the app ’ sulfur independent screen door and go to the Connection › SSH › Auth section. Inside, you ’ ll find a field called Private key file for authentication :
Click on the Browse button, and then locate the secret key file you stored on your calculator. Select it, and you ’ re good to go .
ultimately, you need to tell your waiter to disable the default password-only authentication method for the new drug user you merely set up. To do that, log into your waiter as the fresh drug user via SSH, and run this command :
sudo nano /etc/ssh/sshd_config
This will open the sshd_config file using the Nano editor program. Look for the line that reads PasswordAuthentication inside that file, and delete the # polarity before it. then change its value from Yes to No, so it reads like this :
Save the changes to the file, and reboot your server. The adjacent time you attempt to log in, you ’ ll alone be able to do so using your private cardinal and passphrase .
Step 5: Set Up a Firewall for Your VPS
We ’ ve covered a batch of ground so far about how to set up a VPS. however, there ’ sulfur still one concluding step to perform if you want to keep your server impregnable. That is to enable a firewall for it .
You can do this using the iptables program, which enables you to set up rules that restrict traffic to and from your server. This process is a morsel necessitate, though, so we recommend that you check out our wax guide on how to set up iptables and configure the program by rights .
This footfall may seem like overkill at first. With Iptables, however, you ’ ll be able to restrict which ports enable traffic to access your server. This will stop a batch of attacks in their tracks. Plus, it ’ s a erstwhile apparatus march, so it pays to do it right away .
Ready to Move On?
Learn how to connect your domain name with your raw design – How to Point a Domain to VPS ?
Step-by-step guide to migrating from managed hosting – How to Migrate a Website from Shared Hosting to VPS ?
Learning how to set up a VPS after upgrading from shared host is like leaving the kiddie consortium to dive into an Olympic-sized one. You have a fortune more room and features to play with, but you ’ ll need to find your footing before you can start having fun. now that you know how to configure your VPS, you ’ ve become acquainted with the command production line, which will make it a distribute easier to set everything up to your liking .
Do you have any questions about how to set up a VPS ? Let ’ s talk about them in the comments part below !
Will Morris is a staff writer at WordCandy. When he ‘s not writing about WordPress, he likes to gig his stand-up comedy routine on the local circuit .