Lesson 6 of 6

Get a VPS: LightNode

About 20 minutesRent a small computer that is always on, and log in to it with ssh.

At the end of lesson 5 you closed the lid and your site went dark. That is the tunnel working exactly as designed: it reaches your laptop, and your laptop sleeps, travels and runs out of battery. If something has to keep running, a bot that answers messages, a server that saves data, a script that runs every hour, it needs a computer that never sleeps. You rent one: a VPS, a small computer in a data centre that is always on, driven with the same terminal you learned in lesson 1.

Three places your code can live

Your laptop (+ tunnel, lesson 5)Hosting (Workers, lesson 4)A VPS
What it isYour own computerSomeone else serves your filesA whole Linux computer you rent
On when your laptop sleeps?NoYesYes
Can run any program?YesOnly what the platform allowsYes: you are the admin (root)
Who fixes it when it breaks?YouMostly themYou
CostFreeFree for small sitesA few dollars a month

"Virtual" means you don't get a physical machine: one big server is split into many small ones, and one of them is yours. "Private" means nobody else logs into your slice. It looks and behaves like a real Linux computer with no screen, so the only way in is the terminal.

Shared hosting is the old middle ground: you upload files into a folder on a server many people share, and you can't install your own programs. A VPS is the step up: same price range, but the whole computer is yours.

Here is the difference in one picture. Your laptop is on the left; on the right is a rented server, one blade in a rack in a data centre. SSH in, start the site, then close the laptop and watch what stays up.

Starting with LightNode

There are many VPS companies. This lesson uses LightNode because it is simple, has many locations, and bills by the hour: a small server is about $0.012 an hour (roughly $7.7 a month at most), and when you delete it, the bill stops. You top up a balance first, and it is drawn down hour by hour while your servers exist. Prices change, so check their page before you start.

This part is your homeworkSigning up, paying and creating the server happen in your own LightNode account, on your own computer. This site never asks for payment and can't create a server for you. Read each step, then do it yourself.

Homework: your first server

Tick the steps as you go. Ticks are saved in this browser only.

SSH keys: a lock and a key

ssh (secure shell) is a terminal that runs on another computer. Instead of a password, it can use a key pair. Make one, once, on your own computer:

Terminal
$ ssh-keygen -t ed25519 -C "my laptop"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/you/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
# press Enter for the default file, then type a passphrase you'll remember
$ ls ~/.ssh
id_ed25519    id_ed25519.pub
$ cat ~/.ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... my laptop

Those are files in a folder, exactly like the filing cabinet in the Preliminaries. id_ed25519.pub is the public key: that one line is what you paste into LightNode. id_ed25519 without .pub is the private key. Never paste it anywhere, never send it to anyone, not even an AI.

On Windows, run the same commands in PowerShell: ssh and ssh-keygen come built in.

First login

Terminal
$ ssh root@203.0.113.10
The authenticity of host '203.0.113.10' can't be established.
ED25519 key fingerprint is SHA256:...
Are you sure you want to continue connecting (yes/no)? yes
root@my-server:~# pwd
/root
root@my-server:~# ls /
bin  boot  etc  home  root  usr  var ...

The question about authenticity appears only the first time: your computer is meeting this server and remembers it from now on. Then you're in a different computer, but it's the same folders-and-paths world as your own: pwd, ls and cd all work. Type exit to come back to your laptop.

If you set a password instead of a key, add your key now so you never need the password again. Run this on your computer, not the server:

Terminal
$ ssh-copy-id root@203.0.113.10

First thing on any new server: fetch security updates.

On the server
root@my-server:~# apt update && apt upgrade -y
Stop paying when you stop using itHourly billing runs as long as the server exists. When you are done experimenting, delete (release) the server in the console. Switching it off may not be enough to stop the bill.

Optional: run something on it

Install Node (the same LTS as lesson 2), copy your hello folder up with scp (secure copy), and start it.

On the server
root@my-server:~# curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
root@my-server:~# apt install -y nodejs
root@my-server:~# node --version
v24.11.0
On your computer
$ scp -r ~/hello root@203.0.113.10:~/
On the server
root@my-server:~# cd ~/hello
root@my-server:~/hello# node server.js
open http://localhost:3000

Now localhost:3000 on the server answers. To see it from your browser, use the tunnel from lesson 5: install cloudflared on the server and run cloudflared tunnel --url http://localhost:3000. Same command as on your laptop; the difference is that this computer never sleeps, so the address keeps working when you close the lid.

When you close the terminal, node server.js stops too. Keeping it running for good (a service) is the next thing to ask your AI agent for, and now you can follow what it does.

You are the admin nowA VPS sits on the open internet from the minute it's created, and bots start knocking within hours. Use keys instead of passwords, keep it updated, and don't run commands on it you don't understand, especially ones an AI wrote with rm in them.

Which file do you paste into LightNode when it asks for your SSH key?

The .pub file is the public half: safe to share, it's the lock. The file without .pub is the private key, it never leaves your computer.

You shut your laptop. What happens to node server.js running in an ssh session on your VPS?

The server is always on, but a program you start by hand lives only as long as your session. Run it as a service (or ask your agent to set one up) to keep it going.

Remember
  • A VPS is a rented Linux computer that is always on; you reach it with ssh user@ip.
  • The account, payment and server are your own homework, in your own LightNode console.
  • ssh-keygen makes a key pair: share the .pub, guard the other one.
  • Hourly billing runs until you delete the server.