Upgrading shared hosting to Windows VPS is relatively easy. But learning how to configure Windows VPS can be tricky, especially for those who are not familiar with the command line.
In this tutorial we will teach you how to configure Windows VPS in 5 steps:
- Accessing the server via command line (SSH).
- Updating the server.
- Creating a new user and granting privileges.
- Enabling a public authentication key.
- Configuring a firewall for Windows VPS.
Before we talk about technical details, let’s explain why you need to configure Windows VPS server. So let’s prepare our VPS!
Why You Need to Configure Windows VPS Server
When you hire a basic hosting plan, it is common for the provider to set up all the necessary software. With shared hosting, for example, you’ll probably have access to a dashboard to manage your account:
These panels offer all the basic features you need. However, you may not have access to the server settings, since other users are hosted on it.
With a Windows VPS, on the other hand, you have a server environment totally for you. In most cases it is necessary to install only the basic software – like Apache or Nginx – the rest is at your discretion. This means you need to go a few steps further to have your new server ready to use, for example:
- Decide the right time to switch to Windows VPS.
- Learn how to connect and execute commands.
- Find out how to install new software.
- Configure new users (if necessary).
- Enable a firewall.
When we refer to running commands on the server, this is what we are talking about:
The common thing is to interact with the Windows VPS server through the command line, rather than a GUI. At first it’s a bit intimidating, but with a few searches on Google and following some tutorials you’ll soon get the hang of it.
You also have the option of installing a graphical control panel to manage the server. But we will not cover this subject here, since the command line is more efficient in many cases. What’s more, learning some commands is great for anyone who wants to learn more about server management, something useful for anyone who owns a growing website.
5 Steps To Setting Up Your New Windows VPS Server
As you may know, most servers use Unix-based systems. This means that you need to learn the commands created for this type of system, which are different from Windows. If you want to learn more about Windows server management, check out more in this guide.
Step 1: Accessing the server via command line (SSH).
There are several ways to connect to a server, in addition to the browser. For example, you can use File Transfer Protocol (FTP) , which allows you to upload, download, and edit files on the server:
Although the FTP protocol is very useful, it does not allow you to execute commands on your server. For this you need a Secure Shell (SSH) connection , a different protocol that allows remote access to servers.
After connecting to the server via SSH it is possible to execute commands. It is also known for its strong encryption and authentication protocols, which makes it quite secure. Learning how to use SSH is the first step to being a manager in server management.
After hiring a Windows VPS plan , your provider will provide some credentials such as:
- The IP of the server;
- A username (usually root );
- A password for your root account ;
If you are not familiar with the term, a root (or superuser ) account is a user with all the privileges on a particular system. It is the equivalent of an administrator, but with even more power.
When configuring Windows VPS , you start with a single root account to make the initial connection to the server. If you use a machine with Unix-based OS you can connect directly through the terminal.
But for Windows users, the first step is to install an SSH client. We are partial to two clients in specific, the first of them is Bitvise :
If you are looking for a simple interface that resembles the classic Windows style, this is your choice. However most of the work is done inside the command line, so appearance does not count as much.
We are also big fans of PuTTY , which has a much simpler interface. However, it offers a number of additional configuration options, which is preferable for those who want to delve deeper into the subject.
Let’s use PuTTY in the rest of the tutorial. So go ahead and download the program, then install it on your machine. You will see a screen like this:
Here you need to enter the IP of your server in the Host Name (or IP address) field , and leave the port ( Port) with the default value 22 :
In addition to SSH connections, port 22 is also used for secure logins and Secure File Transfer Protocol (SFTP).
You will notice that just below the field where the IP was inserted there are some options for the connection type. Select SSH, then just click the Open button .
A window with the command line will open, now just enter the access information. In our case we will enter the root user and the corresponding password:
If the data is correct, some information about the server will be displayed, and you will be able to run commands:
We have completed the first step in the initial setup of your Windows VPS server. Do not close the command line window yet, we have more work ahead.
Step 2: Updating the Server
As soon as you access the server there will be a message showing if there are any package or security updates available:
Packages are basically Unix software. Regardless of the system, it is always recommended to keep all software up to date, with no exceptions.
If you have some outdated software this can generate security vulnerabilities for your server and site, as well as lose new features, tools and performance improvements. That’s why the second step is to perform all available updates.
To get started, type the apt update command and press Enter . Your server will now be checking which packages need to be updated. Once complete, run apt dist-upgrade to perform the upgrade:
This process may take a while depending on how many updates your server needs.
After all the updates have been installed, restart the server with the reboot command . Then, close the command line window. Wait a few minutes and reconnect to the server through the SSH client.
If everything went smoothly, there should be no more updates available. That means we can move on in the Windows VPS setup.
Step 3: Creating a new user and granting privileges.
When we set up a new Windows VPS server, we use the root user , which is what we have used so far. But it’s usually a good idea to create a new user with superuser privileges.
This is because the root account can cause serious damage to the server if you do not know what you are doing. A root account has full access to all system settings, so a wrong command and you can lose everything.
A common user account with superuser privileges needs to add the sudo prefix on any command to execute with administrative privileges. This may seem like a small change, but it makes a big difference. So you need to think twice before running a command with the sudo prefix , which helps in preventing crashes.
Let’s create a new user with the following command (be sure to replace newuser with the username of the user you want to add):
Then, enter this line to insert the user into the group with permission to execute sudo commands, which grants superuser privileges (again, do not forget to replace new user ):
# usermod -aG sudo novousuário
All that is left now is to create a password for the new user. But there is a much more secure method than a common password, which is the next step.
Step 4: Enabling a public authentication key.
Public key authentication is a much safer technique than conventional passwords. With it you generate a set of ‘public’ and ‘private’ keys.
The server will store the public key and use it to authenticate the private key, which only you will own on your computer. Once the public key is set up, you will need the private key and a password, which is much safer.
To generate SSH keys in Windows, you can use the PuTTYgen app , which was installed together with the SSH client (to learn how to do this on Linux systems, check out this tutorial ). Let’s open PuTTYgen now:
It’s okay to use the default settings to generate your keys, then right click on the Generate button . To make the key even more unique and random, the program will ask you to keep moving the mouse cursor in the indicated area:
Then the program will display the public key created for you. First of all, enter a key passphrase that will be used together with the key:
Now click on the Save private key button , and save the private key on your computer. You will also need a copy of your public key, so do not close the program yet.
Log in again on the server with the root user , now change to the user created with the # su – novousuario command . The command line will change to the name of the new user:
At this point you need to execute a series of commands in the specified order to create a new folder for the key, restrict the directory permissions and save the key:
- mkdir ~ / .ssh
- chmod 700 ~ / .ssh
- nano ~ / .ssh / authorized_keys
The last command will open the Nano editor , allowing you to modify the authorized_keys file on your server. Copy the public key generated in PuTTYgen and paste it here.
Once the key is ready, press CTRL + X to close the editor and press Y to confirm the changes to the file. Then type the commands:
chmod 600 ~ / .ssh / authorized_keys
These latter commands will change the permissions for the files you just edited, then return to the root user .
Now we need to configure the private key in PuTTY so that the server recognizes the key on the next connection. To do so, return to PuTTY and go to Connection> SSH> Auth . Here you will find the Private key file for authentication field :
Click Browse, and then select the private key file that you saved to your computer.
Finally, we need to disable default password access on the server for the user we just created. To do so, access the server with the new user and execute the command:
sudo nano / etc / ssh / sshd_config
This will open the sshd_config file with the Nano editor. Look for the line with PasswordAuthentication and delete the # sign before it. Then change the value Yes to No , thus:
Save the file changes and reboot the server. The next time you access the server the private key and password will be required.
Step 5: Configuring a firewall for Windows VPS
We already covered a lot about the Windows VPS server configuration. But there is yet another step to keep the server safe: enable the firewall.
You can do this with the iptables program, which allows you to create rules that restrict traffic to the server. This process is somewhat complex, so we recommend that you check out the Iptables Tutorialand configure the program correctly.
This is going to be torture at first. But with Iptables you can restrict the traffic of certain ports on your server, preventing several attacks. What’s more, you only have to do it once.
Learning how to configure Windows VPS server after migrating from a shared hosting is to leave the amateur league to play with the pros. There’s still a lot for you to do, but at least you already have a clue where to start. Now that you know the initial steps to configure Windows VPS and are more familiar with the command line, it will be much easier to leave everything to your liking.
Got any questions about setting up a Windows VPS server? Let’s talk in the comments section below!