15 min read
What is a VPS and how to rent a server
In one sentence: A VPS is a virtual machine you rent by the month in a data center: it has its own public IP, an empty Ubuntu and administrator access. You give it your public key when you create it, and you log in over SSH from your terminal.
What you will learn
- Tell shared hosting, a VPS and a dedicated server apart, and know which one the shop needs.
- Explain what a data center gives you that your home connection doesn't.
- Choose a server's size, region and image, and give it your public SSH key.
- Log in to your server over SSH, and know why logging in as root is only for the first time.
Before you start, read: 00-introduction.md phase-1/09-ssh.md
The problem
Section titled “The problem”Picture Ana with an old computer at home, and she decides to put the shop on it: she installs Docker, runs docker compose up and the shop works. She gives the address to Marta, who opens it on her phone, away from home. It doesn’t load.
It isn’t Docker’s fault, or the shop’s. It’s the home network: as you saw in Phase 0, the router throws away the connections nobody started from inside. And even if Ana opened a port, the shop would go down every time the power went out or her internet provider changed her IP.
That’s why almost every website lives on rented servers, in buildings made for that. This lesson teaches you to rent one, and to log in to it for the first time.
The analogy
Section titled “The analogy”The analogy
Think about where to live in a city. You can rent a room in a shared house: cheap, but with the house rules, and you can’t move a single piece of furniture. You can rent an apartment: the key is yours, and inside, you decide. Or you can buy a whole house.
They’re the three ways of having a server: shared hosting is the room, a VPS is the apartment and a dedicated server is the house. The building, with its doorman, its electricity and its water, is the data center.
Where the analogy breaks down
- The neighbors in an apartment building don’t come into yours, but they share the elevator. On a VPS you share the processor and the disk: if a neighbor uses them a lot, your server can get a bit slower.
- An apartment doesn’t get bigger. A VPS does, from the dashboard, in a few minutes.
- The landlord shouldn’t come into your home. The provider has the physical computer in its building, and technically it could read your disk: renting a server means trusting the provider.
How it really works
Section titled “How it really works”Three ways to rent a server
Section titled “Three ways to rent a server”All three are rented by the month, but they give you very different things:
| Shared hosting | VPS | Dedicated server | |
|---|---|---|---|
| What you get | A folder and a dashboard to upload your website | A whole virtual machine, with its own system | A whole physical computer |
| You log in as administrator | No | Yes, over SSH | Yes, over SSH |
| You can install Docker, PostgreSQL or your API | No: only what the dashboard offers, almost always PHP and WordPress | Yes | Yes |
| You share the physical computer | With hundreds of websites | With other VPSs | No |
| Rough price | From a few euros a month | From a few euros a month | Tens of euros a month or more |
The shop needs a VPS. Docker, PostgreSQL, Redis and an API that stays listening can only be installed by whoever runs the system. A dedicated server is for when a VPS gets too small, and the shop is far from that.
A VPS is a virtual machine in a data center
Section titled “A VPS is a virtual machine in a data center”A VPSVPS stands for Virtual Private Server.A virtual server you rent by the month in a data center. It’s a virtual machine with its own system, its own public IP address and administrator access, inside a physical computer it shares with other customers’ machines.Go to definition (Virtual Private Server) is the same thing as your course VM: a Virtual machineA computer simulated inside another, with its own operating system, its own users and its own files. What happens inside doesn’t touch the computer outside.Go to definition with its Ubuntu, its users and its files. The difference is where it is.
courselives on your laptop. Multipass shares your processor and your memory between your Mac (or your Windows PC) and the VM.- A VPS lives on a provider’s huge computer, with dozens of other customers’ VPSs. A program, the hypervisor, gives each one its share of processor, memory and disk, and doesn’t let one see another.
A VPS starts out empty, without Docker, without nginx and without your shop, as Phase 7 warned you: you install everything yourself.
What a data center gives you that your home doesn’t
Section titled “What a data center gives you that your home doesn’t”That huge computer is in a Data centerA building full of servers, with backup power, cooling, security and fast internet connections with public IP addresses. It’s where rented servers live.Go to definition: a building made so that servers never go down and can be reached from anywhere.
| Your home | A data center | |
|---|---|---|
| The IP | One Public IP addressIP stands for Internet Protocol.An IP address that is unique across the whole internet, so a computer can be reached with it from anywhere. At home, it usually belongs to your router and all your devices share it.Go to definition for your whole wifi, shared through NATNAT stands for Network Address Translation.What the router does on the way out to the internet: it replaces your device’s private IP address with its own public one, and notes the change so it can undo it in the replies.Go to definition, and it sometimes changes | A fixed public IP for each server |
| Connections coming from outside | The router throws them away | They reach the server |
| If the power goes out | Everything goes down | Batteries and generators |
| The connection | Fast to download, slower to upload | Fast both ways, and over several routes |
| Who watches over it | Nobody | Staff, cameras and access control |
The row that matters most is the first one. With a public IP of its own, a connection from the internet goes straight to your server, with no home router in between to throw it away. It’s what Phase 0 promised you:
- Your terminalana@laptop, private IP 192.168.1.133
goes out through your router's NAT
- Your routeryour home's public IP
internet
- The data centerits network, connected over several routes
port 22
- Your VPSpublic IP 203.0.113.10
The other way around doesn’t work: the VPS can’t start a connection to your laptop, because your router would throw it away.
Providers and prices
Section titled “Providers and prices”Some well-known VPS providers in Europe are Hetzner, DigitalOcean, OVHcloud and Scaleway. Prices change often; these were two small plans from two of them on October 17, 2026:
| Provider and plan | Processors | Memory | Disk | Price a month |
|---|---|---|---|---|
| Hetzner Cloud CX23 | 2 | 4 GB | 40 GB | €5.49, before VAT and without the IPv4, which is paid separately |
| DigitalOcean Basic | 1 | 512 MB | 10 GB | 4 dollars |
Hetzner’s price has been in effect since June 15, 2026, according to its price adjustment page. Its processors are shared with other customers, as in the analogy: for a small shop, that’s plenty. None of the links in this lesson earns a commission.
Choosing the size, region and image
Section titled “Choosing the size, region and image”When you create a VPS, the provider’s dashboard asks you three questions.
The size: processors, memory and disk. For the shop, memory is what matters: PostgreSQL, Redis, the API, nginx and Docker need about 2 GB. With 512 MB, the system starts killing processes. If you fall short, you can move to a bigger plan later.
The region: the city of the data center. Choose the one closest to the people who’ll use your website: every request goes there and back, and with a faraway server every RTTRTT stands for round-trip time.The round-trip time between two computers. Every handshake costs at least one RTT, so with a faraway server everything starts later.Go to definition is longer.
The image: the operating system that comes installed. Choose Ubuntu 26.04 LTS, the one this course uses. LTS (Long Term Support) means it gets security updates for five years, according to Ubuntu’s release cycle.
Your public key, before the server exists
Section titled “Your public key, before the server exists”In Phase 1 you put your public key in course’s authorized_keys, and that’s how you logged in without a password. A VPS is the same, with one change: you give the key to the provider before the server is created, and the first time it boots, a program, cloud-init, writes it into root’s authorized_keys.
What you paste in the dashboard is your public key, the line in id_ed25519.pub. You print it with cat ~/.ssh/id_ed25519.pub, and it starts with ssh-ed25519. The private key never leaves your computer.
If you don’t give it any key, some providers, like Hetzner, email you a password for root: exactly what you don’t want, a password anyone can try to guess.
The first time you log in as root, and it’s the last
Section titled “The first time you log in as root, and it’s the last”When the server boots, the dashboard shows you its public IP. On Hetzner and DigitalOcean you log in as root, Linux’s administrator:
ssh root@203.0.113.10The prompt ends in # instead of $: it’s Linux’s way of reminding you that you’re rootThe Linux administrator, user number 0. Permissions don’t apply to it and it can do anything, so it’s used as little as possible.Go to definition and that nothing will stop you. Other providers, like AWS, create a ubuntu user with sudo for you, like the one on your VM.
That first login as root should be the last, for three reasons:
- A mistake or a stolen key reaches the whole server. As
root, anrmin the wrong folder deletes the system, and whoever has your key has everything. - Bots try
rootbefore anything else. It’s the only user that exists on every Linux, and programs all over the world try to log in with it on every public IP, from the very first minute. - There’s no record of who did what. If several people log in as
root, the log can’t tell them apart.
In lesson 2 you’ll use this first session to create your own user with sudo and shut the door on root. After that, you’ll always log in with your user.
Try it
Section titled “Try it”The goal: to have a server and log in to it over SSH with your key from Phase 1, without a password. Do the free path; the paid one, only if you’ve decided to rent a VPS.
Free path: log in to course over SSH
Section titled “Free path: log in to course over SSH”Your server is the course VM, the one you prepared in the introduction. First, its address. In your computer’s terminal (on Windows, in PowerShell), type multipass info course and look for the IPv4 line: it’s your VM’s IP on the network Multipass creates inside your computer.
The outputs are from a VM with the IP 192.168.5.15. Use yours: on a Mac it usually starts with 192.168.64., like Phase 1’s 192.168.64.2.
If you already did the SSH exercises in Phase 1, your key is already on the VM: skip to the next step. If you created course again in the introduction, or you’re on Windows, give it your key now:
Give the VM your public key
cat ~/.ssh/id_ed25519.pub | multipass exec course -- tee -a /home/ubuntu/.ssh/authorized_keysGet-Content ~\.ssh\id_ed25519.pub | multipass exec course -- tee -a /home/ubuntu/.ssh/authorized_keysWhat you will see:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH1J8D66fBXvFa+Sddit+S/7D8bDuFKnzSoZIrjyR9qv ana@laptopIt’s what a provider does for you when it creates a VPS. multipass exec course -- runs tee inside the VM, and tee -a adds your key to authorized_keys and prints it on the screen. Check that it starts with ssh-ed25519: if it starts with -----BEGIN, it’s your private key, and it must not leave your computer.
If it answers No such file or directory for id_ed25519.pub, you don’t have a key: create it with ssh-keygen -t ed25519 -C "ana@laptop", as in Phase 1. Your key will be different.
Now log in, with your VM’s IP:
Log in to your server
ssh ubuntu@192.168.5.15ssh ubuntu@192.168.5.15What you will see:
Welcome to Ubuntu 26.04 LTS (GNU/Linux 7.0.0-28-generic aarch64)…System load: 0.07 Processes: 125Usage of /: 54.2% of 13.49GB Users logged in: 0Memory usage: 30% IPv4 address for eth0: 192.168.5.15Swap usage: 0%…179 updates can be applied immediately.142 of these updates are standard security updates.To see these additional updates run: apt list --upgradable…ubuntu@course:~$No password and no passphrase: your key opened the door. Look at three things in the welcome message:
IPv4 address for eth0is the same IP as inmultipass info, seen from inside.179 updates: an Ubuntu image gets older from the day it’s published, and a brand-new server already comes with security updates pending. Lesson 2 makes them install on their own.- The prompt
ubuntu@course:~$: you’re on the server, with no desktop or mouse, as the terminal lesson warned you. Whatever you type runs there.
If it’s the first time you log in with that IP, before the welcome message ssh asks you about the server’s fingerprint, as in Phase 1. Compare it with the one Multipass gives you, with multipass exec course -- ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub, and answer yes if it’s the same.
Your Phase 1 VM will say Ubuntu 24.04, and your numbers will be different. If it answers Permission denied (publickey), your key isn’t on the VM: repeat the previous step. If it answers Connection timed out, the IP isn’t your VM’s, or the VM is stopped: look at multipass info course.
Once inside, ask the VM for its addresses:
Your server's addresses
hostname -IWhat you will see:
192.168.5.15 172.17.0.1hostname -I prints the server’s IPs, separated by spaces:
192.168.5.15is the one on the network with your computer, the one you just logged in through.172.17.0.1is the one on Docker’s network, created by the engine you installed in the introduction, as you saw in Phase 7.
Both are Private IP addressIP stands for Internet Protocol.An IP address that only works inside a local network, such as 192.168.1.133. The same ones are reused in millions of homes, and they can’t be reached from the internet.Go to definition: neither can be reached from the internet. On a VPS, the public IP the provider gave you would be among them. Log out with exit.
Now ssh course works too, if in Phase 1 you created the nickname in ~/.ssh/config with your VM’s IP. If the IP has changed, change it there. On Windows, that nickname lives in WSL’s ~/.ssh/config: in PowerShell, type ssh ubuntu@ and the IP.
Paid path: create your server
Section titled “Paid path: create your server”The steps are the same with almost any provider; Hetzner’s guide and DigitalOcean’s show them with screenshots.
-
Create an account with the provider and add a payment method.
-
Upload your public key. In the dashboard’s SSH keys section, paste the output of
cat ~/.ssh/id_ed25519.pub. On Windows, on the paid path you can stay in WSL, with your key from Phase 1: a VPS is on the internet, and WSL reaches it like any other program. -
Create the server: the region closest to your users, the Ubuntu 26.04 image, a plan with at least 2 GB of memory, a public IPv4 and your SSH key ticked. Give it a short name, like
shop. -
Write down the public IP the dashboard gives you when the server boots.
-
Log in as
rootwithssh root@and your IP, as in the example above with203.0.113.10. Answeryesto the fingerprint question: from here on,known_hostsmakes sure it doesn’t change. -
Do only what’s needed. Check you’re in with
hostname -I, which shows your public IP among others, and log out withexit. Don’t install anything yet: lesson 2 starts in thisrootsession and locks the server down before anything else.
For as long as it exists, the server is billed, even if it’s turned off. If you leave the course halfway, delete it from the dashboard.
You have already seen it
Section titled “You have already seen it”- Your
courseVM is a small VPS: a virtual machine with Ubuntu you log in to over SSH. Only the building changes. - A rented Minecraft server is part of a server in a data center, with its public IP, so your friends can reach your game. Your shop needs the same thing.
- This very website isn’t on a VPS: Cloudflare serves it from its data centers, with no server for you to run. It’s another model, the one in lesson 7.
Common mistakes
Section titled “Common mistakes”- Choosing the cheapest plan without looking at the memory. With 512 MB, PostgreSQL, Redis and the API don’t fit, and the system kills processes. Look at the memory before the price.
- Pasting the private key in the dashboard. The right line starts with
ssh-ed25519. If you pasted something that starts with-----BEGIN OPENSSH PRIVATE KEY-----, delete that key from the dashboard, create a new pair and never use the old one again. - Recreating the server and
sshrefusing. If you delete a VPS (or the VM) and the new one has the same IP, its server key is different, andsshanswersREMOTE HOST IDENTIFICATION HAS CHANGED!. If you know you recreated it yourself, delete the old one withssh-keygen -Rand the IP, as in Phase 1’s common mistakes.
Summary
Section titled “Summary”- Shared hosting gives you a folder and a dashboard; a VPS, a whole virtual machine with administrator access; a dedicated server, a physical computer. The shop needs a VPS.
- A data center gives your server what your home doesn’t have: a fixed public IP that connections from outside reach, backup power and a fast connection both ways.
- When you create a VPS you choose a size (for the shop, about 2 GB of memory), a region (close to your users) and an image (Ubuntu 26.04 LTS), and you give it your public key.
- The first login is as
root, and it should be the last: in lesson 2 you create your user and shut the door onroot.
Did you get it?
Section titled “Did you get it?”To review:
Further reading
Section titled “Further reading”- Virtual private server, on Wikipedia.
- Creating a server, from Hetzner’s documentation: every option in the dashboard, from the region to cloud-init.
- How to create a Droplet, from DigitalOcean’s documentation: the same with another provider.
- Ubuntu release cycle: what LTS means and how long each version lasts.
- cloud-init: the program that writes your key on the first boot.