A few months ago, I noticed my old laptop lying in the corner, untouched and gathering dust. It wasn’t powerful enough for my daily work anymore, but I didn’t feel like throwing it away either. That’s when the idea struck me: why not turn it into a home server?
I wiped everything off, installed a fresh copy of Ubuntu Server, and slowly started experimenting. At first, it was just about getting the basics running, but one thing led to another. Soon, I had a NAS for file storage, AdGuard to block ads across my network, a media server for streaming, a VPN for secure browsing, and even a place to run some of my own apps.
This blog covers how I set things up, the tools I used, and some lessons I picked up along the way. If you’ve got an old machine lying around, this might give you a reason to bring it back to life.
Base Ubuntu Server Setup
I won’t go too deep into the installation here (that probably deserves its own blog — let me know if you’d like one). If you’re new, you can follow this reference video — it’s a solid guide for installing Ubuntu Server. Just watch until the installation part if that’s all you need, or continue further if you want a deeper dive. Here’s a quick outline of the steps you’ll likely follow:
- Created a flash drive with the Ubuntu Server image.
- Logged into BIOS and changed boot order.
- Booted from USB and installed Ubuntu with mostly default values.
- Chose DHCP for network initially (later switched to static IP).
- Selected the laptop’s drive for installation.
SSH Setup
First things first — let’s make this laptop feel like a real server by setting up SSH. This way, I can connect remotely without ever needing to touch it physically.
Install SSH Server
sudo apt update && sudo apt install openssh-server -y
- Check status: systemctl status sshd
- By default, it should start automatically.
Change Default SSH Port
- Open the SSH config: sudo vi /etc/ssh/sshd_config
- Find the line with #Port 22, uncomment it, and change it to something non-default, e.g.: Port 2222
This helps avoid random automated attacks.
Disable Password Authentication
- Still in sshd_config, set: PasswordAuthentication_,_ This ensures only key-based logins work — much safer.
Sometimes you also need to update /etc/ssh/sshd_config.d/50-cloud-init.conf.
Add Your Public Key
- On your client machine , generate a key if you don’t already have one: ssh-keygen -t ed25519 -C “your_email@example.com”
- Then copy it to the server: ssh-copy-id -i ~/.ssh/id_ed25519.pub @server-ip -p 2222 (Note: The steps below include ways to find your server’s IP address.)
- This adds your key to ~/.ssh/authorized_keys on the server.
In the End Restart SSH Server sudo systemctl reload sshd, Now you can try connecting like this: ssh @server-ip -p 2222
After setting up SSH keys, you might still not be able to connect from your client. That’s usually because of the firewall or changing IP addresses. To make things smooth, we’ll:
- Assign a static IP to the server.
- Open the correct ports in the firewall.
- Configure the client for easy SSH access.
Step 1: Find Your Current IP
Before setting a static IP, you need to know your network interface and current IP. Here are a few ways:
- Using ip command: ip addr showip addr show. Look for inet under your ethernet interface (e.g., enp4s0).
- Using ifconfig (may need sudo apt install net-tools):
- Using hostname -I:
This shows all IPs assigned to the machine.
Step 2: Set a Static IP and Connect to wifi
Connect to your router and pick an available IP. Usually, numbers at the higher end of the subnet (like .7, .100, etc.) are free. Then edit your netplan config (/etc/netplan/01-netcfg.yaml or similar):
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
addresses:
- 192.168.1.7/24
gateway4: 192.168.1.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
wifis:
wlan0:
addresses:
- 192.168.1.50/24 # your static Wi-Fi IP
gateway4: 192.168.1.1 # usually same as router
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
access-points:
"Your_SSID":
password: "YourPassword"
Apply the new configuration: sudo netplan apply
Now your server will always have the same IP, which makes connecting much easier.|
Step 3: Configure the Client
On your client machine, you can simplify SSH access by creating ~/.ssh/config:
Host MyServer
HostName 192.168.1.7
User your-username
Port 2222 # or the port you set for SSH
IdentityFile ~/.ssh/id_ed25519
After this, you can connect simply with: ssh MyServer
Step 4: Configure Firewall
Ubuntu uses UFW to manage access.
- Enable/disable UFW:
sudo ufw enable
sudo ufw disable
- Allow SSH (default port or custom port):
sudo ufw allow ssh # if using default port 22
sudo ufw allow 2222/tcp # replace 2222 with your custom SSH port
- Check firewall status: sudo ufw status
With a static IP and firewall configured, your SSH connection should work reliably from your client.
Alright, enough of the setup — let’s get into the good stuff.
Network Storage (NAS with Samba)
So, what’s the point of a NAS? Think of it like your personal cloud — a drive you can connect to from multiple devices at the same time, without messing with wires or constantly plugging in drives.
Before setting up the NAS, I mounted a 50GB external drive on my server. I recommend doing the same so that your operating system runs on a separate drive, and the mounted drive can be fully dedicated for storage.
Step 1: Identify and Prepare the Drive
- Check available storage: lsblk
- Find the drive you want to use (e.g., /dev/sda).
- If the drive has existing partitions, clear them:
sda
|
--sda1
--sda2
# Command to clear this
sudo wipefs -a <drive path>
# eg.
sudo wipefs -a /dev/sda
Note: Moving Forward Please use your own drive path instead of /dev/sda.
Step 2: Create a Partition
- Start partitioning: sudo gdisk /dev/sda
- Commands in gdisk:
- n → create new partition
- Accept defaults to use the entire drive
- w → write changes
- y → confirm
- Verify the partition: sudo gdisk -l /dev/sda
Step 3: Format the Partition
Create an ext4 filesystem: sudo mkfs.ext4 /dev/sda1
- If prompted about an existing filesystem, type y.
Step 4: Mount the Partition
- Go to /mnt and create a folder:
cd /mnt
sudo mkdir data
- Make the folder immutable (optional, prevents accidental deletion):
sudo chattr +i data
- Find the UUID of your partition:
sudo blkid /dev/sda1
# eg.
/dev/sda1: UUID="b2e62f4f-d338-470e-9ae7-4fc0e014858c" TYPE="ext4"
# Copy
UUID="b2e62f4f-d338-470e-9ae7-4fc0e014858c"
- Edit /etc/fstab to mount automatically on boot: sudo vi /etc/fstab
UUID="b2e62f4f-d338-470e-9ae7-4fc0e014858c" /mnt/data ext4 defaults 0 2
- Mount the drive using sudo mount -a
- Check it was mounted properly using df -h
Now the drive will mount automatically on each restart, and you can freely create files in /mnt/data.
Step 5: Set Up Network Storage with Samba
- Install Samba and create a user:
sudo smbpasswd -a striker
- Add a share configuration in /etc/samba/smb.conf:
[share]
path = /mnt/data
valid users = striker
read only = no
- Restart the Samba service: sudo systemctl restart smbd.service
- Allow in UFW: sudo ufw allow samba
- Connect from another device (e.g., Mac) via Go > Network Server, mounted at /Volumes/.
Now you have a NAS you can access anytime on your local network. The steps to connect may vary slightly depending on the device.
AdGuard Home with Docker
Next, I wanted my server to act as a network-wide ad blocker using AdGuard Home.
Docker Compose for AdGuard
- Create a directory for AdGuard (create on system storage not attached storage):
mkdir ~/adguard
cd ~/adguard
- Create a docker compose file: vi docker-compose.yaml
version: '3'
services:
adguard:
image: adguard/adguardhome:latest
container_name: adguard
restart: unless-stopped
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "68:68/tcp"
- "80:80/tcp"
- "443:443/tcp"
- "3000:3000/tcp"
volumes:
- ./adguard/work:/opt/adguardhome/work
- ./adguard/conf:/opt/adguardhome/conf
Fixing the Port 53 Conflict
Ubuntu’s systemd-resolved already uses port 53. To free it for AdGuard:
- Create a custom config in /etc/systemd/resolved.conf.d/adguardhome.conf
[Resolve] DNS=127.0.0.1 DNSStubListener=no
- Backup existing config:
mv /etc/resolv.conf /etc/resolv.conf.backup
- Create a symlink:
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- Restart systemd-resolved:
systemctl reload-or-restart systemd-resolved
Now AdGuard runs on port 53 without issues.
Steps
- Run docker-compose up -d to start AdGuard
- On another machine in same network, go to: http://:3000
- You will see the Get Started screen. Select all the default options and create an admin user.
- Log in to your admin account.
- Update DNS settings:
- Go to **Settings > DNS Settings
- For Upstream DNS Server , clear the field and add 1.1.1.1** (Cloudflare)
- For Fallback DNS Server , add 8.8.8.8 (Google)
- Click Test Upstreams and then Apply
- To use AdGuard, change your router or devices to use this DNS server. It’s best to update at the network level so you don’t have to configure each device individually. If configured only on a device, it will work only for that device. Your server must keep running for AdGuard to function.
- You can explore more settings to customize AdGuard, but the above steps cover the bare minimum setup needed.
Jellyfin Media Server with Docker
To manage and stream my media, I installed Jellyfin — an open-source alternative to Plex.
Docker Compose for Jellyfin
- Create a directory for Jellyfin (create on system storage not attached storage):
mkdir ~/jellyfin
cd ~/jellyfin
- Create a docker compose file: vi docker-compose.yaml
services:
jellyfin:
image: jellyfin/jellyfin
container_name: jellyfin
user: 1000:1000
network_mode: 'host'
volumes:
- ./src/config:/config
- ./src/cache:/cache
- type: bind
source: /mnt/data/jellyfin-media
target: /media
restart: unless-stopped
extra_hosts:
- 'host.docker.internal:host-gateway'
Steps
- Run docker-compose up -d to start Jellyfin
- Create the required directories for config, cache, and media:
mkdir -p /mnt/data/config
mkdir -p /mnt/data/cache
mkdir -p /mnt/data/media
- Access Jellyfin from another machine in same network: http://<your-server-static-ip>:8096
- Follow the setup guide:
- Create a user for yourself.
- For the media folder, leave it as is for now.
- Select your preferred metadata language (default works fine).
- In Configure Remote Access, check both checkboxes.
- At this point, the server page will load but show “nothing here” initially.
- Add your media:
- Inside /mnt/data/media, create folders for your content (e.g., movies, tv).
- Go to Menu > Dashboard > Library in Jellyfin.
- Add your media libraries through this page.
- Now your media will appear on the home page. You can:
- Create different folder structures for movies and TV series.
- Add multiple users.
- I Suggest to Explore settings to customize further.
Note: Jellyfin automatically downloads metadata for your media.
Currently, everything is available only on your local network. If you want remote access or want to deploy your apps for access from anywhere, check out this blog: Host Local Projects Without Static IP Using Cloudflare Tunnel. This allows you to move your apps from local-only to remote access.
Setting up a home server on an old laptop has been surprisingly rewarding. From remote SSH access to a NAS for file storage, network-wide ad blocking with AdGuard, and a media server with Jellyfin, I now have a versatile system running multiple services smoothly.
If you’re curious about taking it further — like hosting your own AI models (think ChatGPT), setting up an automated torrent service with indexers, trackers, and downloaders, or deploying other custom applications — let me know. I can create dedicated blogs diving into each of these topics in detail.
—
Refs:
202510110450
Top comments (0)