How to Set Up a VPS: Step-by-Step Guide
Quick answer: To set up a VPS, choose an operating system, connect to the server via SSH, update the system, create a separate administrator account, configure SSH keys and a firewall, install the software your project needs, connect your domain, enable HTTPS, configure backups and monitoring, and then deploy and test your website or application.
For most Linux VPS setups, the process looks like this:
- Choose and deploy a VPS with your preferred operating system.
- Connect to the server using SSH.
- Update the operating system and installed packages.
- Create a non-root user with
sudoprivileges. - Configure SSH key authentication.
- Enable a firewall and allow only required ports.
- Install a web server, database, runtime or other required software.
- Configure backups and monitoring.
- Deploy your website or application.
- Test the server and make sure all services work correctly.
How to Set Up a VPS
Setting up a VPS gives you full control over the server environment. You can configure the operating system, install your own software, manage users, configure network rules and prepare the server for websites, applications, databases or other workloads.
Cloud2Y VPS provides root access, allowing you to install and configure the software required for your project.
1. Choose a VPS and Operating System
The first step is to choose the VPS configuration according to the workload you plan to run.
Consider:
- CPU cores and performance;
- RAM capacity;
- SSD or NVMe storage;
- network speed;
- expected traffic;
- operating system;
- required software and control panels.
For most web projects, Linux is a practical starting point. Ubuntu, Debian and other popular distributions can be used depending on your technical requirements.
Choose an operating system that is compatible with the software you intend to install. Changing the operating system later may require reinstalling the VPS and can result in data loss.
2. Get Your VPS Access Details
After deploying the server, you need the information required to connect to it:
- server IP address;
- username;
- temporary password or SSH key;
- SSH port;
- operating system.
For Linux, the standard way to manage a VPS remotely is SSH.
3. Connect to the VPS via SSH
On Linux or macOS, open Terminal and connect to the server with:
ssh root@YOUR_SERVER_IP
Replace YOUR_SERVER_IP with the actual IP address of your VPS.
On Windows, you can use PowerShell, Windows Terminal or another SSH client.
If the server uses a non-standard SSH port, specify it with:
ssh -p PORT root@YOUR_SERVER_IP
After authentication, you should see the command-line interface of your VPS.
4. Update the Operating System
Before installing applications, update the server.
For Ubuntu or Debian:
apt update
apt upgrade -y
Regularly installing security updates helps keep the operating system and installed packages protected against known vulnerabilities.
After major system updates, check whether a reboot is required:
reboot
Reconnect to the VPS after the server becomes available.
5. Create a Separate Administrator Account
Running every command as root is unnecessary and increases the consequences of an accidental or malicious command.
Create a separate user:
adduser admin
Then give the user administrative privileges:
usermod -aG sudo admin
Test the account:
su - admin
You can now use sudo for administrative operations:
sudo apt update
Keep the root account available for emergency administration, but use the dedicated administrator account for normal server management.
6. Configure SSH Keys
SSH keys are a secure and convenient way to authenticate to your VPS.
On your local computer, generate an SSH key if you do not already have one:
ssh-keygen -t ed25519
Copy the public key to the VPS:
ssh-copy-id admin@YOUR_SERVER_IP
Then test the connection:
ssh admin@YOUR_SERVER_IP
Once key authentication works correctly, you can disable password authentication in the SSH configuration.
Edit the SSH configuration:
sudo nano /etc/ssh/sshd_config
Set:
PasswordAuthentication no
Then restart SSH:
sudo systemctl restart ssh
Important: test a new SSH session before closing your existing connection. Otherwise, an incorrect SSH configuration could lock you out of the server.
7. Configure the Firewall
A firewall should allow only the network connections your server actually needs.
For Ubuntu, you can use UFW.
Install it if necessary:
sudo apt install ufw -y
Allow SSH:
sudo ufw allow OpenSSH
If the VPS will host a website, allow HTTP and HTTPS:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Enable the firewall:
sudo ufw enable
Check the current rules:
sudo ufw status
Do not open database, administration or application ports to the entire Internet unless your architecture specifically requires it.
8. Set the Hostname and Basic Server Settings
A meaningful hostname makes server administration easier, especially when you manage multiple VPS instances.
Check the current hostname:
hostnamectl
Set a new hostname:
sudo hostnamectl set-hostname web-server
You can also verify the server's date and timezone:
timedatectl
Correct system time is important for logs, certificates and scheduled tasks.
9. Install the Software Required by Your Project
The exact software stack depends on what you want to run on the VPS.
For a typical website, you may need:
- Nginx or Apache;
- PHP or another application runtime;
- MySQL, MariaDB or PostgreSQL;
- Git;
- SSL/TLS;
- a process manager;
- caching software.
For example, to install Nginx:
sudo apt install nginx -y
Check its status:
sudo systemctl status nginx
For an application server, the required stack may be different. Node.js, Python, Java, Docker or other technologies can be installed according to the project's requirements.
10. Configure Your Domain
If the VPS will host a website, point your domain to the server's IP address.
For a typical setup, create an A record:
Type: A
Name: @
Value: YOUR_SERVER_IP
For a www subdomain:
Type: A
Name: www
Value: YOUR_SERVER_IP
DNS changes may take some time to propagate.
After DNS is configured, create the appropriate virtual host or server block in Nginx or Apache.
11. Enable HTTPS
Do not leave a production website running only over HTTP.
Configure an SSL/TLS certificate for your domain and redirect HTTP traffic to HTTPS.
HTTPS protects data transferred between visitors and your server and is essential for modern websites, APIs and applications.
12. Configure Backups
A VPS should not be considered a backup by itself. Important data should have a separate backup strategy.
Back up at least:
- databases;
- website files;
- application configuration;
- uploaded media;
- important server configuration.
Cloud2Y VPS includes daily backups for VPS environments.
For critical projects, maintain an additional independent backup so that you are not relying on a single storage location.
13. Install Monitoring
Once the VPS is configured, monitor the resources that can affect application performance:
- CPU;
- RAM;
- disk usage;
- disk I/O;
- network traffic;
- load average;
- service availability.
Check disk space with:
df -h
Check memory:
free -h
Check running processes:
top
For production systems, use a monitoring solution that can send alerts when CPU, RAM, disk space or service availability reaches predefined thresholds.
14. Deploy Your Website or Application
After the basic VPS configuration is complete, upload or deploy your project.
A typical deployment can look like:
git clone YOUR_REPOSITORY
Then configure:
- environment variables;
- database connection;
- application user;
- file permissions;
- web server;
- domain;
- SSL;
- scheduled tasks;
- logs.
Avoid running the application as root. Create a dedicated system user whenever possible.
15. Test the VPS After Configuration
Before considering the VPS ready for production, test the main components.
SSH:
ssh admin@YOUR_SERVER_IP
Firewall:
sudo ufw status
Web server:
sudo systemctl status nginx
Disk:
df -h
Memory:
free -h
Network:
ping -c 4 example.com
Also test the website from an external connection and verify that HTTPS, DNS, redirects and all important application functions work correctly.
VPS Setup Checklist
- ✓ VPS deployed
- ✓ Operating system updated
- ✓ Separate administrator created
- ✓ SSH keys configured
- ✓ SSH access secured
- ✓ Firewall enabled
- ✓ Required ports opened
- ✓ Hostname configured
- ✓ Required software installed
- ✓ Domain connected
- ✓ HTTPS enabled
- ✓ Backups configured
- ✓ Monitoring configured
- ✓ Website or application deployed
- ✓ Services tested
What to Do After Setting Up a VPS
Once the initial configuration is complete, the next steps depend on your project. A simple website may only require Nginx, PHP, a database and SSL. A more complex application may require Docker, Redis, a reverse proxy, multiple application services and monitoring.
The main advantage of a VPS is that you can adapt the server to these requirements instead of being limited by the configuration of shared hosting. Cloud2Y VPS provides root access and allows you to install and configure the software required for your workload.
