How to configure VPS on Windows
09:20, 09.06.2021
The operating system of your server determines anything you can further do with your server, so the choice of it is critical. Unlike shared hosting, a VPS server allows you to choose your operating system like it would be the case with a dedicated server. If you’re going to go for Windows VPS, then your next step after acquiring the server will be to configure your VPS Windows. In the following, if you want to have a look at what exact steps you have to take to achieve optimal basic configuration of your Windows VPS. But first, let’s have a look at what VPS is generally about.
What Exactly is a VPS?
A VPS is an abbreviation referring to a Virtual Private Server. This is a hosting solution that is based on virtualizing the resources of a particular entire physical server thus creating numerous independent virtual instances that work even not actually ‘aware’ of being virtualized. This way you get a solution that is about as functional as a dedicated server, but on a small scale, so you can choose a perfect server for projects of smaller scale, especially when your budget is not unlimited.
Differentiating Between a Dedicated Server and VPS
A dedicated server, in contrast to VPS, is just a whole physical server that you use directly without previous virtualization of its resources. Dedicated servers provide maximum resources of what any server can offer. However, they are in higher grade specialized for accommodating large projects, like full-scale e-commerce website or anything else that involves rich functionality, complex applications, a lot of content, etc. A dedicated server is a great solution in case you will be able to take advantage of all resources that it offers. If your projects are not so big, however and you want to allocate your budget more wisely, you should rather consider going for a VPS server.
Comprehensive Guide to Setting Up and Managing a VPS
Now, let’s have a look at some crucial steps of setting up and managing your VPS.
Step 1: Select Your VPS Hosting Provider
To configure a VPS, you first need to acquire one. You should carefully choose your hosting provider according to the needs of your projects. There is no such thing as a best provider; rather, different providers have different specificity, often targeting specific types of clients. Just weigh up all the parameters that are crucial for your project and look for the providers that correspond to this criteria. The general criteria might include hardware specifications, pricing policies and billing cycles, capacities included in available plans, uptime, support, available locations, available operating systems, and many others.
Step 2: Set Up a New Virtual Machine with Your Preferred OS and Specifications
When picking your VPS hosting plan, at some point you’ll be able to choose what particular operating system you want to be installed on it. Although there are a variety of Linux distributions, all of the systems follow more or less the same pattern when it comes to system configuration. With Windows, however, the steps you take will have a bit different form. Therefore the following instructions will include exploring the general configuration for Linux distributions and configuration for Windows.
Step 3: Access Your VPS via SSH
The access to a VPS is usually done through SSH, SSH being a network security protocol that enables secure access and file transfer between devices over an unsecured network.
Instructions for Windows Users
- Download and Install PuTTY: To SSH a VPS from Windows, you’ll need a special piece of software PuTTY which is a free SSH client for Windows. You can download it from the official website.
- Obtain your VPS IP address which should be included into the main login credentials which are provided by your VPS hosting provider.
- Launch PuTTY and enter your VPS IP Address, which should be entered in the 'Host Name' field.
- Connect to your VPS: Click 'Open' to initiate the SSH connection. You'll be prompted to enter your username (usually 'root') and password.
Instructions for Linux or macOS Users
Accessing your VPS server through SSH while being Linux or a macOS user is a bit more straightforward. Let’s see:
- Open terminal: Both Linux and macOS have built-in terminal applications.
- Use the SSH command: Type ssh root@your_vps_ip_address and press Enter.
- Authenticate: You'll be prompted to enter your root password or the passphrase for your SSH key if one is set up.
Step 4: Update Your Package Manager and Install Essential Software
A package manager is an important tool for automating the processes of installing, updating, configuring, and removing software packages on an operating system.
On a Windows VPS:
Update Windows: Go to Settings > Update & Security > Windows Update, and check for updates.
Install Necessary Software: Use the Server Manager to add roles and features or manually install software like IIS, SQL Server, or any other required applications.
On a Linux VPS:
1.Update Package Manager
For Ubuntu/Debian: sudo apt update && sudo apt upgrade
For CentOS/RHEL: sudo yum update
2. Install Essential Software:
- Web server (e.g., Apache or Nginx): sudo apt install apache2 or sudo apt install nginx
- Database (e.g., MySQL): sudo apt install mysql-server
- Additional tools as needed (e.g., Git, Docker): sudo apt install git docker.io
Step 5: Enhance Security by Setting Up a Firewall
A firewall is a fundamental element of the security of any devices that have a connection to the world wide web. A firewall is a security system that is responsible for monitoring incoming and outgoing traffic. It filters traffic based on a configurable set of rules, that generally limit the traffic that can pass, this is minimizing the risk of different types of cyber attacks. For example, it can permit only certain types of traffic while like HTTP or HTTPS and block other types of traffic that are for the most part either unnecessary or are likely to bear risks. The basic setting of the firewall involves just a couple of steps, so let’s have a look at them.
On a Windows VPS
- Access Windows Firewall: Open the Control Panel, navigate to System and Security, and select Windows Firewall.
- Create Inbound and Outbound Rules: Use advanced settings to configure rules that control traffic to and from your VPS. Inbound rules affect the traffic that comes to your server, outbound rules deal with traffic that goes out of your website, being thus rather an optional parameter. Creating inbound rules involves the following steps:
- Navigate to Inbound Rules:
In the left pane, click on Inbound Rules.
- Create a New Rule:
In the right-hand pane, click on New Rule….
Select Port and click Next.
- Specify the Port:
Choose TCP or UDP depending on the protocol you want to control.
Specify the port(s) you want to open (e.g., port 80 for HTTP, port 22 for SSH).
Click Next.
- Allow or block the Connection:
Choose Allow the connection to permit traffic through this port.
Choose Block the connection if you want to deny traffic.
Click Next.
- Specify Profile:
Select the network profiles (Domain, Private, Public) where this rule should apply.
Click Next.
- Name the Rule:
Give the rule a name (e.g., "Allow HTTP Traffic") and an optional description.
Click Finish to create the rule.
As for outbound rules, by default WIndows allows all outbound traffic, but you can nevertheless create some rules if this is necessary for your case. Creating them follows the same pattern as creating inbound rules.
On a Linux VPS (Using UFW)
- Install UFW (if not installed):
sudo apt update
sudo apt install ufw
- Check UFW status to see if it’s active before making any changes:
sudo ufw status
- Allow SSH connectionssince these connections are necessary for managing your VPS:
sudo ufw allow ssh
The default port for SSH connections is 22. If you have a different port, you can specify it by using this command:
sudo ufw allow 2222/tcp # Replace 2222 with your SSH port number
- Allow other necessary ports that are required by your applications: For example,
sudo ufw allow http or sudo ufw allow 80/tcp for HTTP.
sudo ufw allow https or sudo ufw allow 443/tcp for HTTPS
- Deny the unnecessary ports. This step is optional, since by default UFW doesn’t allow any ports that aren’t explicitly specified. You can still do it if needed:
sudo ufw deny 12345/tcp # Replace 12345 with the port number you want to block
- Enable the firewall:
sudo ufw enable
- Verify UFW status and rules: After enabling UFW, you can check its status and review the active rules to make sure that everything was done correctly:
sudo ufw status verbose
After typing tyis command you’ll see the status, active or inactive, as well as the list of connections that are either allowed or denied.
- Manage rules. You can, for example delete a rule by specifying the exact rule or by using its rule number:
sudo ufw delete allow 8080/tcp # Deletes the rule allowing traffic on port 8080
You can also disable UFW if needed:
sudo ufw disable
On a Linux VPS (Using FirewallD)
FirewallD is another firewall that is commonly used in Linux systems, in particular on CentOS, RHEL, Fedora and others.
- Install FirewallD (if not installed):
CentOS/RHEL: sudo yum install firewalld
Ubuntu/Debian: sudo apt install firewalld
- Start and Enable FirewallD:
- sudo systemctl start firewalld
- sudo systemctl enable firewalld
To check the status:
sudo firewall-cmd --state
- Allow necessary services or ports:
sudo firewall-cmd --add-service=ssh --permanent for SSH connections
sudo firewall-cmd --zone=public --add-service=https --permanent for HTTPS
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent – to allow specific ports.
- Reload the Firewall:
sudo firewall-cmd --reload
Step 6: Evaluate Your VPS and Set Up Any Needed Services or Applications
Now your VPS is secure and ready. With it now you can start developing your projects in any direction. But before that you might require to install and configure any services or applications that are more specific to your project. These might include:
- Web servers: Apache, Nginx, and many others.
- Databases: MySQL, PostgreSQL, and many others.
- Email servers: Postfix, Sendmail, and many others.
- Containers: Docker, Kubernetes, and many others.
Web servers are responsible for serving web pages to users. When someone enters a URL in their browser, the web server delivers the requested content (e.g., HTML pages, images, CSS files).
Web servers are essential for hosting websites and web applications, and without them the latter wouldn’t be accessible to users over the internet.
Web servers also deal with HTTP Requests, so different pages of your website can be accessed through a browser by your visitors.
Web servers also play an important role in load balancing, used to distribute traffic across multiple servers.
Databases are used to work with data, to store, manage, and retrieve data. They allow you to manage and organize all the files and data related interactions on your website in a way that you see as the most efficient.
Databases’ primary purpose is to store website data, including user data, content, and configurations in a database.
Databases are also responsible for managing relational data with complex queries, that is to handle and organize data in a structured way, particularly in systems where data is related across different tables.
Databases are also responsible for handling transactions and ensuring data consistency and integrity, which is particularly critical in financial applications.
Email servers are used to interact with emails, namely to send, receive, and store emails. They allow you to set up communications between you and your clients as well as you and other companies.
Mail servers are responsible for managing emails, allowing you to send and receive emails with the help of a variety of protocols – for instance SMTP, IMAP, POP3.
Mail servers can be also used to host corporate emails, allowing you to manage internal communication within your company in case it's big enough.
Containers are a type of virtualization which is about packaging and application and its dependencies into a single portable unit that can run consistently across various environments.
Containers are widely used for microservice architectures where different parts of an application are broken down into smaller, independent services.
Another use case for containers are DevOps and CI/CD Pipelines, as the usage of containers greatly simplifies the process of development of various software solutions.