Dec 22, 2025
Aris S. & Valentinas C.
15min Read
Setting up a virtual private server (VPS) gives you more control and flexibility compared to shared hosting. While it may seem complex at first—especially if you’re new to the command line—the process can be broken down into a few straightforward steps.
Start by purchasing a VPS plan from a hosting provider like Hostinger. Then, connect to your server via SSH using a terminal (on macOS or Linux) or a tool like PuTTY (on Windows).
Once connected, update the server software, create non-root users to improve security, and enable SSH key authentication. Finally, set up a firewall to control network access and protect your server.
After the initial setup, you can start hosting websites or applications on your VPS. Tools like Kodee, Hostinger’s AI assistant, make managing your server easier—even if you don’t have a technical background.
A brief overview of setting up a VPS:
| Required Knowledge | Basic understanding of Linux, SSH, and server management |
| Privileges Required | Root or sudo user privileges |
| Difficulty | Beginner |
| Main Goal | Setting up a VPS, hosting a website on a virtual private server |
| OS Compatibility | Various Linux distributions |
When choosing a web hosting plan, consider factors like support, performance, server resource allocation, pricing, and security features.
For example, Hostinger offers various virtual server plans starting at ₱279.00/month.
Our VPS plans differ in server hardware resources, but they share similar features, including snapshot and root access support. You can upgrade your virtual private server plan anytime via our custom hosting control panel, hPanel.
These plans also include robust security features such as Suhosin PHP hardening. Moreover, Hostinger offers Kodee AI assistant to simplify management tasks.

After purchasing a VPS hosting plan from Hostinger, open VPS on the top menu of hPanel and click Setup on the plan in question. Enter all the required information and select your desired operating system template to finish the process.
Hostinger’s VPS hosting plans support most Linux distributions, including CentOS, Ubuntu, and Debian. Although you can switch to another VPS operating system afterward, it will wipe your data.
Check out our comparison of 12 most powerful VPS hosting providers, to help you decide which one works best for your needs.”

In the VPS management menu, navigate to Overview → SSH access to find your server IP address, default SSH port, and root login credentials. All this information is used to connect to your server using SSH service.
You can also find the command for connecting via Terminal in macOS or Linux. After executing the command in the Terminal, enter the root password to connect to your VPS.
For Windows users, use an SSH client like PuTTY. After installing it, follow these steps to connect to your server:
After connecting to your VPS, execute commands in the new line to configure its settings. Enter help in the command line to list the available SSH commands.
Important! After successfully connecting to your VPS, we recommend changing the SSH default listening port to prevent hackers from accessing your server. You can do so by editing the SSH configuration file.
Alternatively, use hPanel’s built-in terminal, which users can use via web browsers. To access it, click the VPS you want to manage → Overview → Browser Terminal.
Using outdated software may expose your server to security vulnerabilities and compromise your site visitors’ data. In addition to strengthening security, updating your VPS ensures you have the latest features and performance improvements.
To update your virtual private server, run the following to check and install all the available updates for your server. Note these commands work for CentOS-based distros:
dnf update dnf upgrade
For other Linux operating systems, replace dnf with their respective package manager. For example, older CentOS uses yum, while Debian derivatives like Ubuntu utilize apt.
The process may take hours, depending on the number of updates, patch size, and internet speed. Once the update is completed, enter the reboot command to restart your VPS and reconnect using the SSH service.
Rebooting is crucial to ensure all updates are installed correctly. Otherwise, older software may still run in the background and prevent the updates from taking effect.
Adding new SSH users with different privileges enables collaboration and gives you more control over VPS administration.
Exclusively assigning root user privileges may expose your server to mismanagement and errors. Accounts with superuser permissions can access and modify all server aspects. Therefore, making mistakes with a root account may cause serious issues.
Creating a normal account with superuser permissions helps minimize risks since it requires the sudo prefix to execute a command with full administrative privileges, for instance:
sudo dnf update
In addition to sudo, your VPS will ask for administrator login credentials to prevent accidental command executions.
To create a new user account, connect to the server’s root user account and enter the following command. Replace username with your desired account name:
adduser username
Then, add the new user to the sudo group to grant the administrative privileges using this command. Replace username with the user in question:
# usermod -aG sudo username
Lastly, set a new password for the user. Use these login credentials to connect to the VPS using an SSH client or Terminal. Repeat the step to add more SSH users to your VPS.
Public key authentication secures your SSH connection using a public-private key pair. This method improves VPS security as it is more difficult to decipher and safer than traditional passwords.
Your server stores the public key, which it will use to authenticate the private one. The private key is only accessible to authorized parties, like the system administrator. In addition to the private key, you need a passphrase to log in.
The steps of generating public key authentication vary depending on your VPS operating system and SSH client. Since we use Windows, check our tutorial to learn more about setting up SSH keys in Linux and macOS.
Otherwise, follow these instructions to generate SSH keys using PuTTYgen, which should come pre-installed with PuTTY:
Keep PuTTYgen open since we will move the public key to your VPS. Before proceeding, ensure you have installed the Nano text editor. Then, connect using PuTTY with root access and follow these steps:
su – username
mkdir ~/.ssh chmod 700 ~/.ssh nano ~/.ssh/authorized_key
chmod 600 ~/.ssh/authorized_keys
exit
Now, follow these steps to change your SSH client settings to use your private key for authenticating the SSH connection:
Once the key pair is set, disable your VPS account’s password authentication mechanism for the new user. To do so, connect to your server as the new user and run this command:
sudo nano /etc/ssh/sshd_config
It will open the sshd_config file using the Nano text editor. Look for the PasswordAuthentication line, delete the # sign preceding it, and change the Yes value to No.
Close the text editor and enter the reboot command to restart your VPS. If the change is applied successfully, your server should request a private key and passphrase to authenticate the SSH connection.
You can also add the SSH keys to your VPS through hPanel.
Unlike a shared hosting service, users must manually configure security features for their virtual private server. Some web hosting providers apply some server-level security measures, but you may still need extra protection.
There are different ways to secure your VPS, one of them is configuring a firewall. A firewall lets you set a rule to automatically filter incoming and outgoing traffic on your server. Cybercriminals may exploit this to launch an attack.
We recommend setting up a firewall called iptables. Since the firewall setup process involves many steps and commands, refer to our iptables tutorial to learn more about it. You only need to configure it once unless you want to add other rules.
Alternatively, you can set up our integrated Hostinger VPS Firewall. Start by choosing your VPS and navigating to the Security → Firewall section:

Then, select Create firewall configuration and give your configuration a name:
Choose Edit:
Add any preferred incoming traffic rules and add them to the list. Changes will take effect in real-time:

With a shared hosting plan, the provider will set up the server and its software for you, including the control panel. You can configure the hosting account but not the host server settings.
On the other hand, virtual private servers give you more freedom. You can install your preferred VPS control panel and configure the server environment. The VPS provider will only set up the virtualization and web server technology, like LiteSpeed or Apache.
Since users must choose and install the control panel or software themselves, setting up a virtual private server takes more time. Users migrating from a shared hosting plan to VPS must learn server management tasks like installing a virtual operating system.
Developers commonly interact with a virtual private server using a secure shell (SSH) network protocol via applications like PuTTY. It lets them connect to the server, transfer files, and execute commands remotely, resulting in a more efficient workflow.
Alternatively, you can install a VPS control panel with a graphical user interface (GUI) for simpler server administration. We recommend it for beginners unfamiliar with code and CLI applications.
Important! A virtual private server differs from a dedicated server. A VPS uses a virtual machine to create multiple hosting environments in one system. Meanwhile, a dedicated server allocates a physical system for each user.
After completing the virtual private server setup process, start hosting a site or web application. Instead of using a command line interface, you can install a GUI control panel to simplify the task.
Hostinger VPS website hosting supports various control panels, including cPanel, Plesk, DirectAdmin, and CyberPanel. Users can choose two installation methods – using a template or manually with a plain virtual operating system.
We recommend using the operating system template for beginners, as it is simpler.
Keep in mind that users can’t freely choose the control panel and operating system combination. You can choose different Linux distributions, but as an example, we will install the AlmaLinux 8 64bit with CyberPanel.
Create a VPS backup before switching your server’s operating system.
Skip this step if you chose the template during the initial VPS setup process. Otherwise, do the following:
Once the control panel is installed, access your VPS CyberPanel dashboard using a web browser using your VPS’ IP address.
For the first method, enter https://vpsipaddress:8090 in your web browser. Replace vpsipaddress with your server’s IP address used for the previous SSH connection.
For the second method, navigate to the Panel access tab in the VPS management menu and enter the Login URL in your web browser.
Both methods require you to enter the login credentials to access the control panel, namely the root user’s username and password. You can change this information in the VPS overview area.
If your VPS doesn’t have a secure sockets layer (SSL) certificate, the web browser will send a warning message. Ignore it and accept the untrusted SSL certificate for now.
Before proceeding, purchase a domain from Hostinger if you haven’t got one. Then, follow these steps to add it to CyberPanel:
You can change all settings anytime.
Make your website accessible by updating your VPS DNS configuration to point the domain name to your server. The easiest way to do it is by changing the DNS A Records. Here’s how to do it at Hostinger:
Important! After pointing a domain name to your VPS, wait for the DNS propagation to finish. This may take up to 24 hours.
Pointing your domain name also lets you enable custom email for your VPS. Check out our tutorial to learn more about hosting an email server on a VPS using CyberPanel.
Once the domain is set, start building your website. If you have an existing one, download the website backup as a ZIP file and upload it to CyberPanel’s file manager. Here’s how to do so:
After adding a domain, issue an SSL certificate and force HTTPS to establish a secure connection to your website. Here are the steps:
In the SSL menu, you can also assign the login page to a domain instead of an IP address for easier access. Once configured, you can log in using https://domain.tld:8090, with domain.tld referring to your VPS domain.
To use another domain as the login page, change your server’s hostname via hPanel. The process may take around 10 minutes, but it is typically instant.
After completing the control panel setup process, install applications for developing your website or web application. For example, we will show you how to install a content management system (CMS) like WordPress:
If you are redirected to the default CyberPanel page, delete the index.html file in the public_html folder.
Since some applications are unavailable in CyberPanel’s installer menu, you must manually add them via File Manager. To do so, download the desired application installer and unpack it to the public_html folder.
If you manually install a CMS, you must also create the database. Here’s how to do it:
To access the database, navigate to Database → phpMyAdmin. You can manage the database settings from this menu, including uploading and importing file backups.
In addition to a GUI, CyberPanel offers various features to simplify your website management and administration tasks.
It has a built-in file manager that lets you efficiently manage your website data without setting up an FTP client like FileZilla. If you prefer using FTP, CyberPanel lets you easily create an account by going to FTP → Create FTP Account.
Cyberpanel also lets you create a new user account in your VPS without using Terminal or PuTTY. You can set the user’s website limit and access permissions – root, reseller, or normal. To access this feature, go to Users → Create new user.
In addition, you can manage your VPS firewall and SSH keys via the control panel. You may also disable the root access to prevent unauthorized modifications of your VPS.
Hostinger’s CyberPanel virtual private server uses the LiteSpeed web server and LSCache plugin to ensure optimal website performance. You can also install the LiteSpeed Memcached (LSMCD) to enable object-caching on your VPS.
CyberPanel also has several features that improve developers’ workflow. For instance, it integrates with Git for easier collaboration and version-controlled development. It also has an API access feature to simplify the remote deployment process.
Users can also install CyberPanel add-ons to add more features to their control panel. Some hosting providers may include some of these add-ons with their plans. Otherwise, users must purchase the one-time license or subscribe to them.
If you have multiple VPSs within the same network, using the same hostname can cause conflicts. To help you avoid such an issue, this section will explain what a hostname is and how to change it.
A hostname is a label for identifying your server. In addition to helping you distinguish your VPS in a network, other systems and applications can use it to identify your machine for data transmission.
Often, a computer’s hostname is set to localhost by default. We recommend changing it since using the same name as others within a network can cause domain resolution issues and complicate system identification.
While there are no specific guidelines for a VPS hostname, use a descriptive name for easier identification. The best practice is to use a domain or subdomain hosted on the same server as the hostname, like vps.domain.tld or vps.tld.
There are two methods to permanently change your Hostinger VPS hostname – via hPanel and a command-line interface.
Option 1 – using Hostinger hPanel (recommended)
We recommend changing your VPS hostname via hPanel because it is more intuitive. This method is also suitable for beginners as it uses a graphical user interface and doesn’t involve commands.
However, keep in mind that other hosting providers may not offer the same feature on their control panel. For Hostinger users, follow these steps to change the VPS hostname:
Wait until the process is complete, which can take up to 10 minutes. To check if the hostname has successfully changed, enter the following command in the Browser terminal:
hostname
Option 2 – Using a Command-Line Interface
If you use another VPS hosting provider, we recommend changing the hostname using Linux commands. There are different commands you can run for this task, but we will use hostnamectl as it is the most straightforward.
Before proceeding, connect to your server using an SSH client, Terminal, or hPanel’s Browser terminal. After connecting as a root user, follow these steps in the command line interface:
sudo dnf install systemd
hostnamectl
hostnamectl set-hostname hostname
hostnamectl
Since we use AlmaLinux 8, the commands may differ for another Linux distribution. However, they should work for other Red Hat Enterprise Linux derivatives like CentOS.
For other distributions and their derivatives, like Debian and Ubuntu, check our tutorial to learn the commands for changing a Linux VPS hostname.
In addition to hPanel, you can check Hostinger VPS’s hostname using the Kodee AI assistant. Simply ask, “What is the current static hostname of my VPS?” and it should output your VPS’s hostname.
Since managing virtual servers can be difficult, Hostinger offers a built-in AI assistant for VPS hosting plans to help simplify the task. In this section, we will discuss how to use it to assist your VPS automation and management.
Automate monitoring and alerts
You can ask Kodee for steps to automate server monitoring and alerting. For instance, use prompts like “How do I automate server uptime monitoring and alerting?”
Kodee will provide you with a step-by-step guide to do so. You can also give a follow-up question to expand each step for more detailed instruction. Here are some example prompts:
Our VPS AI assistant can also provide you with a code template for Grafana, which will help speed up the setup process.
If you want to check logs or data from your VPS, Kodee can also fetch them for you. Simply use prompts like:
Automate security measures
Kodee can give instructions for automating security measures in your virtual server. Depending on the security features to install, the prompts may differ. Here are several examples:
Always provide comprehensive information about your VPS operating systems and other software when asking for code templates, scripts, or commands. It’s important since some Linux distributions may use different commands.
Kodee can also directly manage several security aspects of your VPS, like backups and snapshots. Here are example prompts for doing so:
Automate troubleshooting and diagnostics
Users can ask the AI assistant for steps to automate troubleshooting and diagnostics in their virtual private servers. When unsure which measures to implement, use a more general prompt like:
Once they decide which one to apply, use a more specific prompt for more detailed instructions. Here are some examples:
You can also ask Kodee to perform simple tasks commonly done during troubleshooting, like restarting or resetting your server. The prompts might look like this:
Perform performance optimization
Kodee can provide tips and assistance to improve your server performance using the following prompts:

Switching from regular web hosting to a VPS plan can be difficult for beginners with minimal server administration experience. Virtual private servers require users to manually configure the hosting environment and use the command line interface.
Let’s review the six steps to set up virtual private servers:
You can start hosting a website on a VPS by installing CyberPanel. But first, add a domain and configure the SSL certificate. Then, import your website file or install WordPress to create a new one from scratch. To improve web development tasks, this CyberPanel also offers features like Git integration and API access.
To efficiently manage your server, Hostinger offers Kodee, an AI assistant that is accessible via hPanel. Users can submit various prompts, including how to automate VPS monitoring and management.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.