Building a Home Server From an Old Laptop
Turning a spare laptop into a Debian home server: choosing the operating system, setting it up remotely without locking yourself out, publishing services through a Cloudflare Tunnel, and fixing an AdGuard Home container that ran but couldn't be reached.
Renting a VPS (Virtual Private Server) means paying every month. A home server is paid for once.
As a student, that's an easy choice. The cheapest useful cloud server costs money every month, forever. My old laptop, which had been sitting unused in a room, costs nothing, and its hardware is already better. So I turned it into a server.

To be clear about which machine does what: the five-dollar VPS that runs this website stays where it is. A public web server needs an address that never changes, and it shouldn't stop when the power in my flat goes out. The laptop is for everything else, the services that only my own home network needs to reach.
This is the build log: what I chose, why I chose it, and the few places where things went wrong.
Why an old laptop, of all things
People who run servers at home will often tell you to buy a Raspberry Pi, a used mini PC, or parts for a proper NAS (Network Attached Storage). Those are all good options, for later. For a first server, I think the laptop you already own has some very useful advantages.
- It's free. That's the whole point.
- It has a battery built in. A short power cut doesn't switch your server off. People pay for a separate backup power unit, called a UPS (Uninterruptible Power Supply), to get that for a desktop computer.
- It has a screen and keyboard attached. When the network breaks and you can't log in remotely with SSH (Secure Shell), you don't have to find a spare monitor.
The downsides are real, but manageable. A laptop's fan is louder than a Raspberry Pi with no fan, and an old processor can use more electricity than modern low-power hardware. For a machine that sits in a room running a few containers, that's a fair trade.
Choosing the OS: why not Arch, why not Ubuntu
I use Arch Linux on my desktop, so it was tempting to install what I already know. But a server needs the opposite of what a desktop needs.
On a desktop, getting the newest software quickly is useful. On a server, you want software that doesn't change, and Arch changes all the time on purpose. That matters for two concrete reasons.
First, you can't safely run Arch's update command, pacman -Syu, automatically in the background. Arch updates sometimes need a person to merge settings files by hand, so someone has to watch each update. Second, the kernel is updated almost every week, and a kernel update needs a restart. A server should be a machine you can leave alone, not one you have to watch.
Ubuntu Server is the usual first suggestion. But if you already know your way around Linux, Debian uses the same apt package system, comes with less software installed, and doesn't use Snap packages. It uses less RAM (Random Access Memory) and less CPU (Central Processing Unit) when it's idle. If the goal is to install Docker and leave a laptop running in a room for three years, I think Debian's stable version is one of the best choices there is.
| OS | Best for | Footprint | Package manager |
|---|---|---|---|
| Ubuntu Server | Easy troubleshooting, very large community | Medium | apt and Snap |
| Debian (stable) | Pure stability, nothing extra installed | Light | apt |
| Proxmox VE | Running several separate virtual machines | Heavy | Web GUI and apt |
| Alpine Linux | Getting the most from very old hardware | Tiny | apk |
| Rocky Linux | Learning enterprise Red Hat systems | Medium | dnf |
So I chose Debian. One note about the download page: the version for a normal 64-bit PC is called amd64, even if your processor is made by Intel. AMD created the 64-bit version of the x86 design in 2003, and the name became the standard label for all 64-bit PC processors. Download the netinst image. It's small, and it downloads everything else from the internet during the installation.
Write it to a USB (Universal Serial Bus) stick, start the laptop from the stick, and accept most of the default installation choices. The interesting part starts after the restart.
First boot setup: five small jobs
A fresh Debian installation is an empty machine. Before it can be a server, it needs five things.
1. An editor
First things first: run sudo apt install neovim before anything else.
2. Stop the lid from killing the server
A laptop goes to sleep when you close its lid. For a server, that means it stops working when someone closes the lid while tidying the room. The fix is one line in the file /etc/systemd/logind.conf.
#HandleLidSwitch=suspend ← change this
HandleLidSwitch=ignore ← to this
Then apply the change.
sudo systemctl restart systemd-logind
Now the lid can be closed, and the server keeps running with its screen off, so it takes up very little space.
3. Remote access
Install the SSH server and check that it's running.
sudo apt install openssh-server -y
sudo systemctl status ssh
Find the server's address with hostname -I, then connect from your main computer.
The first time you connect, you are asked to accept the server's host key fingerprint, a code that identifies the server. From then on, the laptop never needs its own keyboard again, and everything below happens over SSH.
4. A static IP, set on the router rather than the server
Your services will be found at the server's address on your LAN (Local Area Network), so that address must never change. There are two ways to fix it in place, and the choice matters more than it seems.
The first way is to set a static IP (Internet Protocol) address in Debian's own network settings. That works. But it also means that one typo in a settings file, typed over SSH, disconnects you from the machine you were setting up.
The second way is a DHCP (Dynamic Host Configuration Protocol) reservation on your router. The router promises to always give the same address to your server's MAC address, its hardware ID. The server itself keeps its default network settings, which are known to work, so there's nothing to break.
The reservation is the safer choice, especially when you work remotely. You need two facts.
ip link # the MAC address of the active interface
ip route | grep default # your router's IP, e.g. "default via 192.168.1.1"
Open the router's settings page by typing its IP address into a browser. Find the section called DHCP, LAN Setup or Address Reservation, because every router maker puts it somewhere different. Reserve your server's current address for its MAC address.
5. A firewall, in the right order
We'll use UFW (Uncomplicated Firewall). Here, the order of the commands matters. You are setting up a firewall over SSH, so you must allow SSH before you turn the firewall on. If you do it the other way round, the firewall cuts your connection and locks you out of your own machine.
sudo apt install ufw -y
sudo ufw allow 22/tcp # FIRST: keep your own connection alive
sudo ufw enable # it warns about disrupting SSH, but 22 is open
sudo ufw status # confirm: active, 22/tcp ALLOW
The base system is done. It runs without a screen, it can be reached remotely, its address is fixed, and it has a firewall. Now it needs something to run.
Docker
Everything this server runs will be in containers: packaged programs that each run separately, with everything they need included. So Docker, the tool that runs containers, goes on first. Debian is so minimal that even the download tool curl isn't installed at first.
sudo apt update && sudo apt install curl -y
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Then add yourself to the docker group, so you don't need sudo for every command, and test it.
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world
When you see "Hello from Docker!", the server is ready to run things.
Exposing it to the internet: Cloudflare Tunnel
The traditional way to make a home server reachable from the internet is port forwarding. You open ports on your router and send them to the server. It works, but then your home's IP address is public, and your router is the only thing protecting you. And some ISPs (Internet Service Providers) share one public address between many customers, using what is called carrier-grade NAT (Network Address Translation), which stops port forwarding from working at all.
A Cloudflare Tunnel works the other way round. A small program on the server connects out to Cloudflare and keeps that connection open. Visitors go to your domain, Cloudflare receives them, and their traffic travels back to your laptop through the connection that's already open. No ports on your router are open to the outside, and your home IP address stays private.
You set it up from a website. You need Cloudflare's Zero Trust dashboard, which is separate from the normal DNS (Domain Name System) one. The free plan asks for a payment method, but doesn't charge you.
- Go to Networks, then Tunnels, then Create a tunnel. Give it a name such as
home-server. - Choose your system: Debian, 64-bit.
- Copy the install commands it shows into your SSH session. They add Cloudflare's package source and install the program.
- Copy the Install as service command. This registers the tunnel with systemd, so it starts when the server starts and keeps running.
- Skip the option to run it by hand. That only runs while your terminal window is open, which is the opposite of what a server needs.
Within seconds, the dashboard changes from "waiting for your tunnel to connect" to a green Connected. The last step is to link a name on your domain to a port on the server. From then on, anything the server can reach on its own ports, the world can reach on your domain through Cloudflare, while your home network accepts no connections from outside.
Network-wide ad blocking with AdGuard Home
The classic first service to run yourself is a DNS sinkhole. Tools such as Pi-hole and AdGuard Home answer every DNS lookup for your whole network, and check each one against lists of known ad and tracking domains. When your smart TV asks for the address of a known ad server, the sinkhole answers with nothing. The ad is never downloaded, so pages load faster and the ad uses none of your bandwidth.
I chose AdGuard Home and ran it with Docker Compose. First, open its ports in UFW.
sudo ufw allow 53/tcp # DNS
sudo ufw allow 80/tcp # web interface
sudo ufw allow 3000/tcp # first-run setup wizard
Then I ran docker compose up -d, opened port 3000 in the browser for the setup wizard, and got nothing. A blank screen.
That started the most interesting debugging session of the whole build. I think it's worth going through, because each step works for other problems too.
Phase 1: is the container even running?
docker ps -a
The status column said Created, not Up. Docker had made the container but refused to start it. That almost always means a port the container wants is already used by something else on the server.
Phase 2: who owns port 53?
AdGuard is a DNS server, so it needs port 53. On many systems, a service called systemd-resolved already uses that port. So I asked the system directly which programs were listening.
sudo ss -tulpn | grep :53
In my case, port 53 was actually free. The only program listening was cloudflared, on a random high port, which is harmless. So port 53 wasn't the problem, and the container's logs confirmed that DNS could start. I checked the next possibility.
Phase 3: the port 80 squatter
Running docker compose up -d again finally showed a clear error.
Error response from daemon: ... failed to bind host port 0.0.0.0:80/tcp:
address already in use
It was the same kind of problem on a different port.
sudo ss -tulpn | grep :80
The cause was Apache, a web server that Debian's installer had set up by default. On this machine, everything runs in containers, so I switched Apache off.
sudo systemctl stop apache2
sudo systemctl disable apache2
Phase 4: the zombie container
With Apache gone, docker compose up -d showed the container as Up. But the setup page still wouldn't load, and docker ps showed the ports column completely empty.
Here is what had happened. When Docker first hit the port 80 conflict, it stopped setting up the container's network halfway. The container existed, but its ports were never connected. Running up again only restarted that same broken container. It was running but couldn't be reached, which is why I call it a zombie.
The fix is to delete the container and build it again, now that the ports really are free.
docker compose down
docker compose up -d --force-recreate
docker port adguardhome # should print: 3000/tcp -> 0.0.0.0:3000
The ports were connected, I refreshed the browser, and the green AdGuard welcome screen appeared. It took much longer than I would like to admit.
One last trap in the setup wizard
The wizard's last screen helpfully lists the IP addresses to set on your devices. Don't use them.
AdGuard runs inside a container, so it shows its internal Docker addresses. If you point your router's DNS setting at one of those, every device in the house loses the internet at once. The address every device should use is the server's real LAN address, the one you reserved on the router earlier.
For block lists, the small community lists are the right choice for a home. They block enough trackers and ads to be useful, and are careful enough not to break your smart TV's updates or a shop's checkout button. Also use the server's IPv4 address when setting up devices. IPv6 addresses on home networks often change, and if your DNS server's address changes, the whole network goes down with it.
What DNS blocking can and can't do
It's worth being clear about the limits, because this method has one built in.
It works well for smart TVs, phone apps and smart home gadgets. You can't install a browser extension on those, and they send a surprising amount of data about you. It also removes ordinary banner ads on every device in the house, and blocks known malware and phishing websites for the whole network.
It can't help with YouTube and Twitch, because they send ads from the same domain as the videos. Blocking the ad would block the video. The same is true of sponsored posts mixed into social media feeds. Some devices also have Google's DNS server built in, and ignore yours completely. There are router settings that force them back to your server, but that's another post.
The right way to use it is as a first layer of protection for the whole network, together with a browser extension such as uBlock Origin on the computers that can run one.
Update: a second drive
About a month after the build, I opened the laptop again to use the one part of it that was empty.
The bottom cover comes off in one piece once its screws are out, and everything can be reached from that side: the fan and the copper heat pipe, two memory slots under their instruction stickers, the Wi-Fi card, the 256 GB M.2 SSD (Solid-State Drive) the laptop came with, the small coin battery for the clock, and the 42 Wh main battery.



The part that matters is in the corner next to the battery: an empty space for a 2.5-inch drive. Dell printed four numbered steps for it on the sticker that covers it.

The space takes an ordinary 2.5-inch SATA (Serial AT Attachment) drive, so I fitted a 1 TB Crucial MX500.


The serial number and the PSID (Physical Security ID) on the label are blurred. The PSID is printed on the drive so that anyone holding it can reset the drive's built-in encryption to factory settings. That's exactly why it shouldn't be posted online.

One terabyte next to the original 256 GB is about four times the space, on a machine that still cost nothing except the drive.
Where this goes next
The laptop that sat unused in a room now runs Debian. It has a firewall, it can be reached over SSH, it publishes services through a Cloudflare Tunnel, and it blocks ads for every device in the house. It cost nothing but an evening, and most of that evening went into one zombie container.
There are many more things a machine like this can run: a media server, file syncing, home automation, or a private Git server. Those are future posts.
The lesson from this one is that an old laptop you no longer use can already be a server. It only needs some setup.
Check yourself
3 questions · nothing is saved- Written
- Jun 13, 2026
- Length
- 2,911 words · 13 min
- Built
- …
- Served by
- …
- Delivered
- …
- Over the wire
- …
- Go's share
- …
How Your Home Network Actually Works
DHCP, ARP, NAT, and the four devices inside your "router": the local half of networking, which happens before a packet ever reaches the internet.
Five Ways to Deploy the Same App
Static host, PaaS, VPS, single binary, Kubernetes: the same React and Go app can be put online in five different ways. A tour of the options, using this website as the example.
Eduroam on Linux: Why One Wi-Fi Network Is So Hard to Join
Eduroam isn't a Wi-Fi password, it's a personal login that works across thousands of universities. Here's how it works, why Linux has trouble with it, and the settings that work.
How Linux Boots: From Power Button to Login
Firmware, bootloader, kernel, initramfs, PID 1: the chain of programs that runs between pressing the power button and seeing a login screen.
Projects built with what this post is about.


