Part 2 of the home server series. A complete, step-by-step guide to installing Docker, running Nextcloud, setting up phone auto-backup, and getting desktop sync working."
In Part 1, I explained why I replaced Google One with a home server and showed the architecture. Now we build it.
This post covers the heart of the setup — Nextcloud running in Docker. By the end of this guide, you'll have a fully working personal cloud that you can access from your browser, sync files from your desktop, and auto-backup photos from your phone.
What you'll need:
- An old laptop or PC (I'm using an HP Pavilion x360, but anything with 4GB+ RAM works)
- Ubuntu Server 24.04 LTS installed (the official install guide takes about 15 minutes)
- A wired or wireless internet connection
- About 30 minutes
Let's go.
Step 1: Give your server a static IP
Before installing anything, your server needs a fixed IP address on your home network. Without this, your router might assign it a different IP every time it reboots, and nothing will be reachable.
Find your current network details:
ip a
ip route | grep default
Note down your interface name (something like eth0 for Ethernet or wlo1 for WiFi), your current IP, and your gateway IP (usually 192.168.1.1).
Now edit the netplan config:
sudo nano /etc/netplan/00-installer-config.yaml
For a wired connection (recommended — if your laptop doesn't have an Ethernet port, a USB-C to Ethernet adapter works great):
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
For a WiFi connection:
network:
version: 2
wifis:
wlo1:
dhcp4: no
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
access-points:
"Your_WiFi_Name":
password: "your-wifi-password"
Apply the config:
sudo netplan apply
Verify it worked:
ip a | grep 192.168.1.100
You should see your static IP. From now on, your server is always at 192.168.1.100 (or whatever IP you chose).
💡 Pick an IP outside your router's DHCP range. Most routers assign IPs in a range like 192.168.1.2 to 192.168.1.99. Setting your server to 192.168.1.100 avoids conflicts. Check your router's admin page if you're unsure.
Step 2: Install Docker
Docker lets you run Nextcloud in an isolated container — easy to install, easy to update, easy to back up.
# Update packages
sudo apt update && sudo apt upgrade -y
# Install Docker
sudo apt install docker.io docker-compose -y
# Start Docker and enable it on boot
sudo systemctl enable docker
sudo systemctl start docker
# Add your user to the docker group (so you don't need sudo every time)
sudo usermod -aG docker $USER
Log out and log back in for the group change to take effect. Then verify Docker is running:
docker --version
docker compose version
Both should return version numbers. If they do, Docker is ready.
Step 3: Prepare storage directories
Create the folders where Nextcloud will store your files. I use /srv/nas as the root — it's a standard Linux convention for service data.
💡 Running low on built-in storage? You can mount an external USB hard drive and point these directories to it. A 1TB external drive costs around ₹4,000 and instantly doubles your capacity.
# Create folder structure
sudo mkdir -p /srv/nas/photos
sudo mkdir -p /srv/nas/videos
sudo mkdir -p /srv/nas/documents
sudo mkdir -p /srv/nas/nextcloud
# Set ownership so Nextcloud (which runs as www-data) can write to it
sudo chown -R www-data:www-data /srv/nas
This gives you a clean folder structure:
/srv/nas/
├── photos/ ← All your photos
├── videos/ ← Personal videos
├── documents/ ← PDFs, spreadsheets, etc.
└── nextcloud/ ← Nextcloud internal data
Later, when we set up Samba (Part 3), these same folders will be accessible as network drives on your Mac or PC.
Step 4: Create the Docker Compose file
Create a directory for your server configuration and add the compose file:
mkdir -p ~/server
cd ~/server
nano docker-compose.yml
Paste this:
version: '3'
services:
nextcloud:
image: nextcloud:latest
container_name: nextcloud
restart: always
ports:
- "8888:80"
volumes:
- ./config:/var/www/html
- /srv/nas:/var/www/html/data
environment:
- NEXTCLOUD_TRUSTED_DOMAINS=192.168.1.100
Let me explain what each line does:
-
image: nextcloud:latest— pulls the latest official Nextcloud image -
container_name: nextcloud— gives the container a clean name -
restart: always— auto-restarts the container if it crashes or after a reboot -
ports: "8888:80"— maps port 8888 on your server to port 80 inside the container -
volumes— mounts your config directory and storage directory into the container -
NEXTCLOUD_TRUSTED_DOMAINS— tells Nextcloud which addresses are allowed to access it. We'll add more later (your domain, Tailscale IP, etc.)
💡 Why port 8888? Port 80 is reserved for potential future services. A non-standard port also adds a minor layer of obscurity. You can pick any unused port you like.
Step 5: Launch Nextcloud
cd ~/server
docker compose up -d
The -d flag runs it in the background. First time will take a minute or two to download the Nextcloud image.
Check it's running:
docker ps
You should see:
CONTAINER ID IMAGE STATUS PORTS NAMES
abc123def456 nextcloud:latest Up 2 minutes 0.0.0.0:8888->80/tcp nextcloud
Now open a browser on any device on your home network and go to:
http://192.168.1.100:8888
You'll see the Nextcloud setup screen.
Step 6: Configure Nextcloud
On the setup screen:
- Create an admin account — pick a username and a strong password. This is your main login.
- Storage & database — select SQLite for simplicity. It's perfectly fine for personal use with 1-3 users. (If you expect more users, you can set up MariaDB/PostgreSQL later.)
- Install recommended apps — check this box. It installs Calendar, Contacts, Talk, and other useful apps.
Click Finish setup. Give it a minute to install everything.
Once done, you'll land on the Nextcloud dashboard — your personal cloud is live.
Step 7: Update trusted domains
Nextcloud only allows access from domains/IPs listed in its trusted domains config. Right now it only knows about 192.168.1.100. We need to add more for later parts of this series.
# Enter the Nextcloud container
docker exec -it nextcloud bash
# Edit the config file
apt update && apt install nano -y
nano /var/www/html/config/config.php
Find the trusted_domains section and update it:
'trusted_domains' =>
array (
0 => '192.168.1.100',
1 => 'files.yourdomain.com',
2 => '100.x.x.x',
),
Replace files.yourdomain.com with your actual domain (we'll set this up in Part 4), and 100.x.x.x with your Tailscale IP once you have it. For now, just add placeholder entries — you can always update later.
Save and exit (Ctrl+X, then Y, then Enter). Then exit the container:
exit
Restart Nextcloud to apply:
docker restart nextcloud
Step 8: Set up phone auto-backup
This is the killer feature — every photo you take automatically syncs to your server.
iPhone:
- Download Nextcloud from the App Store
- Open the app → enter server address:
http://192.168.1.100:8888 - Log in with your admin credentials
- Go to Settings → Auto Upload
- Enable it and select which folders to back up (Camera Roll at minimum)
Android:
- Download Nextcloud from Play Store
- Same steps — enter server address, log in
- Go to Settings → Auto Upload
- Enable for Camera folder
From now on, every photo and video automatically uploads to /srv/nas/ on your server. No more paying Google for photo storage.
⚠️ This only works when you're on your home WiFi for now. In Part 4, when we set up Tailscale and the public domain, auto-backup will work from anywhere.
Step 9: Set up desktop sync
Mac:
- Download the Nextcloud desktop app from nextcloud.com/install
- Install and open it
- Server address:
http://192.168.1.100:8888 - Log in with your credentials
- Choose a local sync folder on your Mac (e.g.,
~/Nextcloud) - Files now sync automatically — like Dropbox or OneDrive
Windows / Linux:
Same process — download the desktop client, point it to your server, and select a sync folder.
You can also access Nextcloud from any browser at http://192.168.1.100:8888 — upload files, create folders, share links, just like Google Drive.
Step 10: Useful Nextcloud commands
A few commands you'll use regularly:
# Check if Nextcloud is running
docker ps
# View Nextcloud logs (useful for debugging)
docker logs nextcloud --tail 50
# Restart Nextcloud
docker restart nextcloud
# Stop everything
cd ~/server && docker compose down
# Start everything
cd ~/server && docker compose up -d
# Force Nextcloud to re-scan files
# (useful after adding files via Samba — covered in Part 3)
docker exec -u www-data nextcloud php occ files:scan --all
# Check disk space
df -h
Troubleshooting
Nextcloud not loading in browser?
- Check the container is running:
docker ps - If not running:
cd ~/server && docker compose up -d - Check logs:
docker logs nextcloud --tail 50
"Access through untrusted domain" error?
- You're accessing from an IP/domain not in trusted_domains
- Add it to the config as shown in Step 7
Upload fails for large files?
- Nextcloud's default upload limit might be too low
- Fix it:
docker exec -it nextcloud bash
echo "upload_max_filesize=16G" > /usr/local/etc/php/conf.d/uploads.ini
echo "post_max_size=16G" >> /usr/local/etc/php/conf.d/uploads.ini
exit
docker restart nextcloud
"Redirect loop" error?
- Clear your browser cookies for
192.168.1.100 - Make sure you're using
http://nothttps://(we don't have SSL yet — that's Part 4)
What you should have now
After following this guide:
✅ Docker installed and running
✅ Nextcloud accessible at http://192.168.1.100:8888
✅ Storage organized in /srv/nas/ with separate folders for photos, videos, documents
✅ Phone auto-backup working on your home WiFi
✅ Desktop sync client connected
✅ Your own personal Google Drive — running on hardware you own
Hardware recommendations
You don't need to buy anything new to follow this guide — the whole point is using what you already have. But if you want to improve reliability or expand your setup, here's what I'd suggest:
- Seagate 1TB External Hard Drive — for expanding storage when your built-in drive fills up. Plug it in via USB and mount it.
- Amazon Basics USB-C to Ethernet Adapter — if your laptop doesn't have an Ethernet port. Wired connection is significantly more reliable than WiFi for a 24/7 server.
- Zebronics 4-Port USB Hub — useful if your laptop is short on USB ports after plugging in an external drive and Ethernet adapter.
- Cat 6 Ethernet Cable (5m) — run this from your router to the server. Cat 6 handles gigabit speeds without any issues.
Disclosure: These are affiliate links. If you purchase through them, I earn a small commission at no extra cost to you. I only recommend products I'd actually use.
What's next
📂 Part 3: Turn your server into a NAS with Samba — We'll make these same folders accessible directly in Mac Finder and Windows Explorer as network drives. This is the fastest way to transfer large files — drag and drop, just like a USB drive.
🌐 Part 4: Access your server from anywhere — Tailscale for private access, Oracle Free VPS + frp for public sharing, and SSL for your custom domain.
🔒 Part 5: Security hardening + lessons learned — UFW, Fail2Ban, SSH hardening, and everything I wish I'd known before starting.
All the config files from this series are available in the companion GitHub repo:
👉 github.com/sasrath/homecloud
Hit Follow if you don't want to miss Part 3. And if you run into any issues with the setup, drop a comment — I'll help you debug it.
Your Google Drive replacement is now running. Next up: making it work like a real NAS. 💾
Top comments (0)