Skip to content

Setting Up Your First VPS from Scratch: A Step-by-Step Guide

A practical guide to setting up your first VPS from scratch: connecting over SSH, updating the system, creating a non-root user with SSH keys, the UFW firewall, installing the web stack (Nginx/PHP/database), an SSL certificate and backups — with commands and tables.

VPSيوسف الحربي28 min read
Illustration of a new server rising from an opened crate with a key and a terminal, representing setting up a first VPS
On this page

Buying a VPS is only half the story. Unlike shared hosting, which comes ready with cPanel and preinstalled software, a VPS arrives completely bare: a raw operating system, an IP address and a root password — nothing else. Everything after that is your responsibility: security, software installation, configuration and maintenance. That is what makes a VPS far more powerful and much cheaper, but it is also what confuses beginners in the first hour. This guide is written to be your companion through that hour and beyond: we start from a completely empty server and finish with a live site running behind an SSL certificate, a firewall and backups. If you are still wondering whether a VPS is right for you at all, start with What a VPS is and when you need one, then come back here to put it into practice.

First VPS setup: the steps in order1 · Connect over SSHSecure server login2 · Update the systemapt update && upgrade3 · Non-root user+ SSH keys4 · Firewall (UFW)Open only needed ports5 · Install the web stackNginx · PHP · database6 · Issue SSLHTTPS via Certbot
First VPS setup in order: SSH > system update > non-root user and keys > firewall > web stack > SSL.

Managed or unmanaged: who is this guide for?

Before running any command, you need to know which type of VPS you bought, because that determines how much of this guide applies to you. There are two main models:

Unmanaged VPS: the provider hands you a raw server only — an operating system, an IP address and root access. Everything after that is on you: security, installation, updates and troubleshooting. This is the cheapest and most flexible type, and it is exactly what this guide covers step by step.

Managed VPS: the provider handles basic security and system updates for you, sometimes installs a control panel (such as cPanel or Plesk), and provides technical support. You pay more for peace of mind. If you have a managed VPS with a panel, many steps in this guide (UFW, installing the stack manually) may already be done or handled through the panel — but understanding what happens under the hood is still useful, and the security section applies to you too.

CriterionUnmanagedManaged
Initial securityEntirely your responsibilityThe provider handles the basics
System updatesManual, or automatic once you configure itUsually managed
Control panelNo (command line only, or install one yourself)Usually included (cPanel/Plesk)
Technical supportLimited (hardware level only)Covers server issues
Flexibility and controlFullSometimes limited by the panel
CostLowestHigher
Skill level requiredIntermediate to advancedBeginner

If you are torn between the options, the comparison of shared vs. VPS vs. managed hosting will help you decide. This guide assumes you are on an unmanaged VPS with a clean Linux distribution, the most common scenario for developers and owners of serious projects.

What do you need before you start?

Before you type the first command, make sure you have the following ready. Missing any of them will stop you halfway:

RequirementDetailsHow to get it
A VPS planA suitable size (CPU/RAM/storage)From the provider's panel when you buy
Operating systemA clean Linux distribution (Ubuntu/Debian/AlmaLinux)You choose it when creating the server
Public IP addressIPv4 (and possibly IPv6)Sent in the server creation email
Root login detailsUsername root + the initial passwordFrom the provider's panel or the welcome email
SSH clientTerminal on macOS/Linux, or PowerShell/PuTTY on WindowsUsually preinstalled, or a free download
A domain (optional for now)To connect later and issue SSLFrom a domain registrar

When choosing a size, neither overdo it nor skimp. A practical rule to start with: a small to medium WordPress site usually runs fine on two cores (2 vCPU), 2–4 GB of RAM and 40–80 GB of SSD storage. The beauty of a VPS is that you can upgrade later in a few clicks, so there is no need to overpay on day one. To find out when moving to a VPS actually becomes necessary, see When you need to upgrade to a VPS.

Choosing a distribution is a decision you will live with for a long time. The three common options follow different philosophies:

DistributionFamilyPackage managerBest forNotes
Ubuntu LTSDebianaptBeginners and general productionThe most popular, huge documentation, 5 years of support for LTS
DebianDebianaptMaximum stabilityOlder but very stable packages, lightweight
AlmaLinuxRHELdnfRHEL/cPanel environmentsA free RHEL alternative, compatible with cPanel

In this guide we use Ubuntu/Debian commands (apt) because they are the most common for beginners, and we point out the AlmaLinux (dnf) equivalents where needed. If you are on AlmaLinux, replace apt with dnf, ufw with firewalld, and the Apache package name apache2 with httpd.

How do you connect to your VPS over SSH for the first time?

SSH (Secure Shell) is the encrypted channel you use to control your server remotely from the command line. After the server is created, the provider gives you an IP address and a root password. Open Terminal (on macOS/Linux) or PowerShell (modern Windows 10/11 ships with a built-in SSH client) and type:

bash
ssh root@203.0.113.10

Replace 203.0.113.10 with your server's actual IP address. On the first connection, SSH shows you the server's fingerprint and asks whether you trust it — type yes. You will then be asked for the initial root password. The characters will not appear as you type (this is normal, for security reasons), so type it and press Enter.

bash
The authenticity of host '203.0.113.10' can't be established.
ED25519 key fingerprint is SHA256:abc123...
Are you sure you want to continue connecting (yes/no)? yes
root@203.0.113.10's password:

If the connection succeeds, you will see the prompt change to something like root@your-server:~#. The # at the end means you are the root user — the account with full privileges. You are now inside your server. The first thing you will do is update it and then stop using root directly, as we will see.

If you get a Connection refused error, the server has most likely not finished booting yet (wait a minute and try again) or the SSH service is on a port other than 22. If you see Connection timed out, the cause is usually a provider-level firewall (Cloud Firewall) blocking the port — check your provider's panel and open port 22 there. The REMOTE HOST IDENTIFICATION HAS CHANGED warning appears if you rebuilt the server on an IP you had connected to before; delete the old line from the ~/.ssh/known_hosts file on your computer and connect again. These three errors cover the vast majority of first-connection problems.

Why should you update the system first?

The system your provider delivers may have been prepared weeks or months ago and contain outdated packages with known vulnerabilities. The first serious step is to update everything to the latest version. On Ubuntu/Debian:

bash
apt update && apt upgrade -y

The apt update command refreshes the list of available packages from the repositories (it installs nothing, it only fetches information), and apt upgrade -y actually installs all available updates (the -y flag automatically accepts every prompt). On AlmaLinux, the equivalent is:

bash
dnf update -y

After updating, it is a good idea to reboot the server if prompted (especially after a kernel update):

bash
reboot

Your SSH connection will drop during the reboot — this is normal. Wait a minute, then reconnect with the same command. Later we will set up automatic updates so you don't have to repeat this step manually every time.

CommandWhat it does
apt updateFetches the list of available packages (installs nothing)
apt upgrade -yInstalls all available updates
apt full-upgrade -yUpgrade that removes/installs packages when needed
apt autoremove -yRemoves unused packages
rebootReboots the server

How do you create a regular user with sudo privileges?

Working day to day as root is dangerous: one small typo can wreck the system, and any vulnerability in a program you run inherits full root privileges. The right practice is to create a regular (non-root) user that you always work with, and to elevate its privileges temporarily with sudo only when needed. Create the user:

bash
adduser ahmed

The command will ask you to set a password for the new user and some optional details (you can leave them blank by pressing Enter). Replace ahmed with the name you want. Now add this user to the sudo group so it can run administrative commands:

bash
usermod -aG sudo ahmed

The -aG flag means "append (a) to the listed group (G)" without removing the user from their other groups — don't forget the a, because usermod -G on its own replaces all of the user's groups. On AlmaLinux, the equivalent group is called wheel:

bash
usermod -aG wheel ahmed

Confirm it worked by switching to the new user and trying a command with sudo:

bash
su - ahmed
sudo whoami

If the last command returns root after you enter the user's password, the privileges work. From now on, work with this account and put sudo in front of any command that needs administrative privileges.

Why all this complexity instead of simply working as root? Because the principle of least privilege is a cornerstone of security. When you work with a regular account, the system stays protected even if you make a mistake, because dangerous commands require an explicit sudo that makes you pause and think. More importantly, any vulnerability in a program you run under your regular account stays confined to that account's limited privileges, whereas if you ran it as root, the vulnerability would inherit the keys to the whole kingdom. This simple separation between your working account and the all-powerful account defeats a wide class of attacks and operational mistakes in one go, which is why every serious hardening guide starts with exactly this step.

How do you set up SSH keys and disable password login?

Passwords can be guessed and cracked by brute force, whereas SSH keys are a cryptographic pair that is practically impossible to break: a private key that stays on your computer and a public key that you place on the server. The strongest step in securing any VPS is to rely on keys alone and disable passwords completely.

On your local computer (not on the server), create a key pair if you don't already have one:

bash
ssh-keygen -t ed25519 -C "your_email@example.com"

The ed25519 type is modern, more secure and faster than the older rsa. The command will ask where to save the key (press Enter for the default location, ~/.ssh/id_ed25519) and for an optional passphrase that protects the private key — setting one is strongly recommended. Now copy your public key to the server. The easiest way:

bash
ssh-copy-id ahmed@203.0.113.10

If ssh-copy-id is not available (as on some Windows systems), you can add the key manually. On the server, under the new user's account:

bash
mkdir -p ~/.ssh && chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys

Paste the contents of your public key (the contents of ~/.ssh/id_ed25519.pub on your computer) on a single line, then save. Fix the permissions — this is a very common point of failure:

bash
chmod 600 ~/.ssh/authorized_keys

Now test logging in with the key from your computer: ssh ahmed@203.0.113.10 should log you in without asking for a password (or ask only for the key's passphrase). Do not move on to the next step until you have confirmed that key login works, or you may lock yourself out.

Once confirmed, disable root login and password login. Open the SSH configuration file on the server:

bash
sudo nano /etc/ssh/sshd_config

Change (or add) the following lines:

bash
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes

Save, then restart the SSH service for the changes to take effect:

bash
sudo systemctl restart ssh

On some systems the service is called sshd instead of ssh — if the command fails, try sudo systemctl restart sshd. Important: keep your current session open and open a new terminal window to test logging in again. If key login works and password login fails, you have succeeded. You have just closed the two most dangerous doors to your server in one go.

Setting in sshd_configValueEffect
PermitRootLoginnoBlocks direct login as root
PasswordAuthenticationnoBlocks password login (keys only)
PubkeyAuthenticationyesEnables login with SSH keys
Port (optional)A number other than 22Reduces the noise of automated break-in attempts

How do you configure the UFW firewall?

A server connected to the internet faces thousands of scan attempts every day. A firewall closes every port by default and opens only what you need. On Ubuntu/Debian, the simple tool for this is UFW (Uncomplicated Firewall). Install it if it is not already there:

bash
sudo apt install ufw -y

Before enabling the firewall, allow SSH first — this is the single most important step, because forgetting it means cutting yourself off from the server the moment you enable it:

bash
sudo ufw allow OpenSSH

Then open the web ports (80 for HTTP and 443 for HTTPS) if you will run a website:

bash
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Now enable the firewall and check its status:

bash
sudo ufw enable
sudo ufw status verbose

It will ask for confirmation (because enabling it may disrupt connections) — type y. If you see OpenSSH, 80 and 443 in the ALLOW list, you are safe. On AlmaLinux, the equivalent tool is firewalld:

bash
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
PortProtocolServiceOpen it if
22TCPSSHAlways (remote administration)
80TCPHTTPYou run a website
443TCPHTTPSYou run a site with SSL (recommended)
3306TCPMySQL/MariaDBExternal database access (rare — usually keep it closed)
25 / 587 / 465TCPSMTP mailYou run a mail server

The golden rule: open as few ports as possible. Your applications should connect to the database locally through localhost, for example, so there is no need to open port 3306 to the outside at all.

Remember that the UFW firewall you configure works at the operating-system level inside the server, and your provider may add a cloud firewall layer above it, managed from the control panel. The two layers are independent: if either one blocks a port, it is effectively blocked even if the other allows it. When troubleshooting an access problem, check both. To change a rule in UFW, list the numbered rules and then delete by number:

bash
sudo ufw status numbered
sudo ufw delete 3

To remove a rule directly by its original form, use sudo ufw delete allow 80/tcp. Keep your rule list clean and easy to understand; every unnecessary rule is a door you have forgotten why you opened.

How do you install the web stack (Nginx + PHP + database)?

The "web stack" is the set of software that receives browser requests, runs your code and stores your data. The most popular stack today is LEMP: Linux + (E)Nginx + MariaDB/MySQL + PHP. LEMP uses an E because Nginx is pronounced "engine-x". Let's install its components one by one.

ComponentRoleCommon alternative
NginxWeb server (receives requests and serves pages)Apache (apache2)
PHP-FPMPHP processor (runs WordPress, for example)—
MariaDBDatabaseMySQL
CertbotIssues and renews SSL certificates—

1) Install Nginx:

bash
sudo apt install nginx -y
sudo systemctl enable --now nginx

The enable --now command starts the service immediately and makes it start automatically on every boot. Open your browser at http://203.0.113.10 — you should see the default Nginx welcome page, proof that the server is receiving requests.

2) Install and secure the MariaDB database:

bash
sudo apt install mariadb-server -y
sudo systemctl enable --now mariadb
sudo mysql_secure_installation

The mysql_secure_installation script is interactive and walks you through basic hardening steps: setting a password for the database root user, removing anonymous users, disallowing remote root login and deleting the test database. Answer Y to all the security questions.

3) Install PHP and its common extensions:

bash
sudo apt install php-fpm php-mysql php-cli php-curl php-gd php-mbstring php-xml php-zip -y

These extensions (php-mysql to connect to the database, php-gd for image processing, and others) are required by applications such as WordPress. Check that the PHP-FPM service is running:

bash
sudo systemctl status php-fpm

(The service name may include the version number, such as php8.x-fpm — use systemctl status php*-fpm if you don't know it.) You now have a complete web stack: Nginx receives requests and passes PHP requests to PHP-FPM, and MariaDB is ready to store your data.

How do you connect your domain and issue an SSL certificate?

A site reached through a raw IP address is not fit for the public. You need a domain that points to your server, then an SSL certificate to encrypt the connection (https). The connection is made with an A record in your domain's DNS settings:

Record typeName (Host)ValueWhat it does
A@The server's IP addressPoints the root domain example.com to the server
AwwwThe server's IP addressPoints www.example.com
AAAA@IPv6 address (if available)Points the root domain over IPv6

Add an A record pointing your domain to the server's IP from your domain registrar's or DNS provider's panel. The change can take anywhere from minutes to hours to spread (DNS propagation). For an in-depth look at record types, see DNS records explained. Check that the domain points to the server:

bash
dig +short example.com

When the command returns your server's IP address, you are ready to issue SSL. We will use Certbot with Let's Encrypt to get a free certificate with automatic renewal:

bash
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d example.com -d www.example.com

Certbot will ask for your email address and your agreement to the terms, then verify that you control the domain, issue the certificate and automatically update the Nginx configuration to redirect all traffic to https. Choose the redirect option when asked. The certificate renews automatically, and you can test renewal with:

bash
sudo certbot renew --dry-run

To dig deeper into certificate options and configuration, see Installing SSL and enabling HTTPS. Your site now runs over an encrypted connection, with the padlock showing in the browser.

How do you set up backups and snapshots?

Backups are not a luxury — they are the safety net that saves you from a destructive mistake, an attack or a hardware failure. Never put them off until after disaster strikes. There are several layers of backups, and each one protects you from a different kind of failure:

Three layers of safe backupsSnapshotOff-siteApplicationInfra snapshotFull off-site copyApp backupFast restoreof whole serverProtects fromserver failureFiles + databasestored separately
Three layers of protection: a fast snapshot, a full copy stored off the server (off-site), and an application/database-level backup.

Snapshots: most VPS providers offer them from the control panel in one click. A snapshot is a complete image of the disk at a given moment and restores the whole server to that moment. They are excellent before any major change (an upgrade, a risky installation), but they are heavy and usually stored on the same infrastructure — so they are not enough on their own.

File and database backups: regular, lighter copies of your content. To back up the site directory:

bash
sudo tar -czf /backups/site-$(date +%F).tar.gz /var/www/example.com

And to back up the database:

bash
mysqldump -u root -p mydatabase > /backups/db-$(date +%F).sql

Off-site backups: the golden "3-2-1" rule: three copies, on two different media, one of them off-site. Copy your files to remote storage (S3, R2 or another server) with tools such as rsync or rclone:

bash
rsync -avz /backups/ user@backup-server:/remote-backups/
Backup typeToolRecommended frequencyProtects you from
Full snapshotProvider panelBefore every major changeSystem errors, failed experiments
Site filestar / rsyncDailyDeleted/corrupted files
DatabasemysqldumpDaily (or more often)Data loss
Off-site copyrclone / rsyncDaily to weeklyHardware failure, full compromise

Automating backups with cron is the step that turns backups from an intention into a habit. To run a daily backup at 3 a.m., edit the cron table:

bash
crontab -e

And add a line such as:

bash
0 3 * * * /home/ahmed/backup.sh

Here backup.sh is a script that combines the backup commands above. Don't forget to actually test a restore from time to time — a backup you have never restored is not a backup, it is an illusion.

How do you monitor the server and read its logs?

Once the server is running, you need to see what is happening inside it: resource usage, errors and unusual behavior. The simplest tool for real-time resource monitoring is htop:

bash
sudo apt install htop -y
htop

htop shows a live view of CPU and memory usage and a list of active processes, so you can instantly see which process is eating resources. Press q to quit. To monitor disk space:

bash
df -h

Logs are the server's eyes on problems. The most important ones:

LogPathTells you about
Nginx errors/var/log/nginx/error.logWeb server problems
Nginx access/var/log/nginx/access.logEvery request that reached the site
System logjournalctlSystem and service events
SSH logins/var/log/auth.logLogin attempts (successful and failed)

To follow a log live while a problem is happening:

bash
sudo tail -f /var/log/nginx/error.log

And to review the logs of a specific service through systemd:

bash
sudo journalctl -u nginx --since "1 hour ago"

Watching auth.log regularly shows you the volume of automated break-in attempts — which brings us to the extra security layer.

What extra hardening is worth the effort?

You have secured SSH and the firewall, but two more layers raise your security significantly for very little effort:

1) Fail2ban — the guard against brute force: it monitors the logs and automatically bans any IP that keeps failing to log in. Install and enable it:

bash
sudo apt install fail2ban -y
sudo systemctl enable --now fail2ban

It ships with a sensible default configuration that protects SSH right away. To check its status:

bash
sudo fail2ban-client status sshd

2) Automatic security updates: so you don't have to rely on memory to update the system, enable unattended security updates:

bash
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure --priority=low unattended-upgrades

This automatically installs critical security updates as soon as they are released, closing vulnerabilities before they can be exploited.

MeasureToolProtects you from
Non-root user + sudoadduser / usermodA destructive mistake run with root privileges
SSH keys + password login disabledssh-keygen / sshd_configBrute-force password cracking
Firewallufw / firewalldExposed ports and unintended services
Automatic banning of attackersFail2banRepeated login attempts
Automatic security updatesunattended-upgradesKnown package vulnerabilities
Off-site backupsrsync / rcloneTotal data loss

If you will run a control panel such as cPanel on the server, it has its own security considerations, covered in Securing cPanel. Together, these layers take your server from "exposed" to "hardened" without hours of work.

Common mistakes when setting up a first VPS

Many beginners make the same mistakes. Knowing them in advance saves you hours of frustration:

  • Working as root all the time: the most dangerous habit. A single typo (such as rm -rf / instead of a specific path) can wipe the system. Always work as a non-root user and elevate with sudo only when needed.
  • Enabling UFW before allowing SSH: it cuts you off from the server immediately. Always allow OpenSSH before ufw enable.
  • Disabling passwords before testing the key: if you turn off PasswordAuthentication and your key doesn't work, you lock yourself out. Test key login in a new window before disabling the password.
  • Wrong permissions on SSH files: the ~/.ssh directory must be 700 and the authorized_keys file must be 600, otherwise SSH silently rejects the key.
  • Opening unnecessary ports: exposing database port 3306 to the outside is a major security mistake. Keep everything you don't need closed.
  • Neglecting backups until disaster strikes: "I'll set it up later" turns into "I lost everything." Set it up from day one.
  • Forgetting to open port 80 before Certbot: domain validation fails. Make sure 80 and 443 are open before issuing SSL.

Troubleshooting

Even when you are careful, you will run into problems. Here are the most common ones and how to fix them:

I locked myself out of SSH (I can't log in): if you disabled passwords and the key doesn't work, or changed the port and forgot to open it, the fix is the emergency console (Console / VNC) in your provider's panel. Every serious VPS provider offers direct browser-based access to the server that bypasses SSH entirely. Log in there as root and fix the configuration (temporarily re-enable passwords, fix the permissions on authorized_keys, or open the port in UFW).

The firewall locked me out: if you ran ufw enable without allowing SSH, use the emergency console, then run sudo ufw allow OpenSSH followed by sudo ufw reload. Or temporarily disable the firewall with sudo ufw disable to regain access, then configure it properly again.

Permission problems (Permission denied): when you see Permission denied (publickey), check the permissions on ~/.ssh (700) and authorized_keys (600), and that the file contains your correct public key. For problems with site files, make sure the owner is the web server user (usually www-data on Ubuntu): sudo chown -R www-data:www-data /var/www/example.com.

A service won't start: when a service (Nginx, for example) fails to start, read the exact reason:

bash
sudo systemctl status nginx
sudo journalctl -u nginx --no-pager -n 50

The most common reason Nginx fails is an error in a configuration file or a conflict on port 80. Test the Nginx configuration before restarting:

bash
sudo nginx -t

If it reports an error, it points to the exact file and line; fix it, then run sudo systemctl restart nginx. If the port is already in use, find the process holding it with sudo ss -tlnp | grep :80.

Expert tips: set a custom SSH port (not 22) to reduce noise; always keep a second SSH window open when changing SSH or firewall settings; take a snapshot before any major change; document everything you change in a notes file on your computer; and install only what you actually need — every extra service is a new attack surface.

Conclusion

Setting up your first VPS looks intimidating, but at its core it is a logical sequence of steps: connect over SSH, update the system, create a non-root user, secure login with keys, close the dangerous doors, enable the firewall, install the stack, connect the domain, issue SSL, then set up backups, monitoring and extra hardening. Each step builds on the one before it, and once you have done it once, it becomes second nature. The overarching rule that will always save you: secure first, always back up, and open as little as possible. That way you own a fast, secure server under your full control — which is exactly what makes a VPS so powerful.

Frequently asked questions

Do I need programming experience to set up a VPS? You don't need to be a programmer, but you do need to be comfortable with the command line and to follow the steps precisely. This guide gives you the commands ready to use. If you would rather avoid the command line entirely, consider a managed VPS with a control panel, or managed hosting.

How long does it take to set up a first VPS? The first time, expect one to two hours if you take it carefully. With practice, this drops to 20–30 minutes. Automating the setup with a script later cuts it down to minutes.

Should I really disable password login? Yes, absolutely. Passwords are vulnerable to brute-force attacks, and automated break-in attempts on port 22 never stop. SSH keys are far stronger, and disabling passwords closes the widest attack surface on the server.

What is the difference between Nginx and Apache? Both are web servers. Nginx is lighter and faster at serving static files and handling thousands of concurrent connections, which is why it has become the most popular choice for modern sites. Apache is more flexible for per-directory configuration (.htaccess). For most new projects, Nginx is an excellent choice.

Are snapshot backups enough? Not on their own. Snapshots are quick to restore, but they are usually stored on the provider's own infrastructure, so they fail if that infrastructure fails or your account is compromised. Follow the 3-2-1 rule: multiple copies, on different media, with one off-site.

What do I do if I lock myself out of SSH? Use the emergency console (Console/VNC) in your provider's panel. It bypasses SSH entirely and gives you direct access to fix whatever you broke — whether it is the SSH configuration, a firewall rule or permissions.

Do I need a domain before setting up the server? Not to get started — you can set up the server, install the stack and reach it by its IP address. But you do need a domain pointing to the server through an A record before you issue an SSL certificate and launch the site publicly.

How does setting up a managed VPS differ from an unmanaged one? With an unmanaged VPS, every step in this guide is your responsibility. With a managed VPS, the provider handles security and updates and often includes a control panel that replaces much of the manual setup. Unmanaged is cheaper and more flexible; managed is easier and more expensive.

How do I know my server is secure enough? The key indicators: no direct root login, no password login (keys only), a firewall that opens only the necessary ports, Fail2ban running, automatic security updates enabled, and regular off-site backups. Once these are in place, you have covered most common risks.

Can I upgrade the server size later? Yes, and this is one of the biggest advantages of a VPS. Most providers let you upgrade CPU, memory and storage in a few clicks with minimal downtime, so start with a modest size and scale up as your needs grow instead of overpaying early.

Frequently asked questions

Do I need programming experience to set up a VPS?

You don't need to be a programmer, but you do need to be comfortable with the command line and to follow the steps precisely. This guide gives you the commands ready to use. If you would rather avoid the command line entirely, consider a managed VPS with a control panel, or managed hosting.

How long does it take to set up a first VPS?

The first time, expect one to two hours if you take it carefully. With practice, this drops to 20–30 minutes. Automating the setup with a script later cuts it down to minutes.

Should I really disable password login?

Yes, absolutely. Passwords are vulnerable to brute-force attacks, and automated break-in attempts on port 22 never stop. SSH keys are far stronger, and disabling passwords closes the widest attack surface on the server.

What is the difference between Nginx and Apache?

Both are web servers. Nginx is lighter and faster at serving static files and handling thousands of concurrent connections, which is why it has become the most popular choice for modern sites. Apache is more flexible for per-directory configuration (.htaccess). For most new projects, Nginx is an excellent choice.

Are snapshot backups enough?

Not on their own. Snapshots are quick to restore, but they are usually stored on the provider's own infrastructure, so they fail if that infrastructure fails or your account is compromised. Follow the 3-2-1 rule: multiple copies, on different media, with one off-site.

What do I do if I lock myself out of SSH?

Use the emergency console (Console/VNC) in your provider's panel. It bypasses SSH entirely and gives you direct access to fix whatever you broke — whether it is the SSH configuration, a firewall rule or permissions.

Do I need a domain before setting up the server?

Not to get started — you can set up the server, install the stack and reach it by its IP address. But you do need a domain pointing to the server through an A record before you issue an SSL certificate and launch the site publicly.

How does setting up a managed VPS differ from an unmanaged one?

With an unmanaged VPS, every step in this guide is your responsibility. With a managed VPS, the provider handles security and updates and often includes a control panel that replaces much of the manual setup. Unmanaged is cheaper and more flexible; managed is easier and more expensive.

How do I know my server is secure enough?

The key indicators: no direct root login, no password login (keys only), a firewall that opens only the necessary ports, Fail2ban running, automatic security updates enabled, and regular off-site backups. Once these are in place, you have covered most common risks.

Can I upgrade the server size later?

Yes, and this is one of the biggest advantages of a VPS. Most providers let you upgrade CPU, memory and storage in a few clicks with minimal downtime, so start with a modest size and scale up as your needs grow instead of overpaying early.