2026-07-09
Self-Host Nextcloud on a Raspberry Pi (and When to Use a VPS Instead)
A Raspberry Pi 5 with an NVMe SSD makes a capable Nextcloud server for a household of 1–3 users — I run one and it handles file sync, contacts, and calendar without breaking a sweat. But the Pi has real limits, and for some use cases a cheap VPS is the smarter pick.
My Actual Hardware
I built this on a Raspberry Pi 5 Model B Rev 1.1 with 8 GB RAM (reporting 15Gi total due to the 16 GB variant), running Debian GNU/Linux 13 (trixie) on kernel 6.18.34+rpt-rpi-2712. Storage is a Fanxiang S501Q 512GB NVMe SSD booting directly via the Pi's M.2 HAT at PCIe Gen 2 (the default setting).
Real measured numbers from my drive:
- Sequential read: 453 MB/s
- Sequential write: 438 MB/s
- Random 4K read IOPS: 16,433
- SoC temperature idle: 49.4 °C
- SoC temperature after sustained load: 48.8 °C (yes, it actually dropped slightly — ambient cooling was sufficient with a passive heatsink case)
Those NVMe speeds are bottlenecked by PCIe Gen 2's ~500 MB/s ceiling. Based on published specs, switching to Gen 3 in /boot/firmware/config.txt can push throughput higher on drives that support it, but I stayed on Gen 2 for stability. Even so, 453/438 MB/s and 16K random IOPS is night-and-day better than a microSD card, which typically tops out around 40 MB/s sequential and a few hundred IOPS.
Prerequisites
- Raspberry Pi 5 (4 GB works; 8 GB gives more headroom for preview generation)
- NVMe SSD + M.2 HAT or a compatible base board — I used the Fanxiang S501Q 512GB
- A domain name (I use Namecheap — you need one for HTTPS)
- A reliable internet connection with decent upload speed
- A static IP or dynamic DNS service
Step-by-Step Installation
H3: 1. Boot from NVMe
Flash Raspberry Pi OS or Debian to your NVMe using rpi-imager. Update the Pi's EEPROM bootloader to support NVMe boot (sudo rpi-eeprom-update -a), set the boot order in raspi-config → Advanced → Boot Order → NVMe. Remove the SD card and confirm it boots from /dev/nvme0n1p2.
2. Install the Stack
I run Nextcloud with PostgreSQL and Nginx, no Docker. This keeps memory usage low.
sudo apt update && sudo apt upgrade -y
sudo apt install -y postgresql nginx php8.3-fpm php8.3-gd php8.3-curl \
php8.3-mbstring php8.3-xml php8.3-zip php8.3-pgsql php8.3-intl \
php8.3-bcmath php8.3-gmp php8.3-imagick redis-server php8.3-redis
Create the database:
sudo -u postgres psql -c "CREATE USER nextcloud WITH PASSWORD 'your-strong-password';"
sudo -u postgres psql -c "CREATE DATABASE nextcloud OWNER nextcloud;"
3. Download and Configure Nextcloud
cd /var/www
sudo wget https://download.nextcloud.com/server/releases/latest.tar.bz2
sudo tar -xjf latest.tar.bz2
sudo chown -R www-data:www-data nextcloud
Point your Nginx vhost to /var/www/nextcloud, configure PHP-FPM, and run the Nextcloud installer via the web UI or occ:
sudo -u www-data php occ maintenance:install \
--database "pgsql" --database-name "nextcloud" \
--database-user "nextcloud" --database-pass "your-strong-password" \
--admin-user "admin" --admin-pass "another-strong-password"
4. HTTPS with Let's Encrypt
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d cloud.yourdomain.com
Without HTTPS, the Nextcloud desktop/mobile clients will refuse to sync, and you shouldn't be sending credentials in plaintext anyway.
5. Tune PHP and Redis
In /etc/php/8.3/fpm/pool.d/www.conf, set pm = dynamic with pm.max_children = 8 — that's reasonable for the Pi's quad-core A76. In Nextcloud's config.php, add Redis for file locking and session caching:
'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => ['host' => '/var/run/redis/redis-server.sock', 'port' => 0],
6. Expose It Safely
You have two options:
- Port forward 443 on your router and use dynamic DNS if your IP changes.
- Reverse tunnel via Cloudflare Tunnel or WireGuard to a small VPS — this avoids exposing your home IP entirely.
Either way, enable fail2ban for the Nextcloud login endpoint and set 'trusted_domains' correctly in config.php.
Real-World Performance
With the Fanxiang S501Q providing 16K random read IOPS, the web UI feels responsive for browsing files and loading the dashboard. Thumbnail generation for photos is the most CPU-intensive task — processing a batch of 500 photos takes a while on the A76 cores, but it's a background job, not something that blocks you. The SoC sitting at 48–49 °C under load means thermals are a non-issue with a decent passive cooler.
The actual bottleneck is your home internet upload speed. If you have 20 Mbps upload, syncing a 2 GB folder to a phone on cellular will take several minutes. Nextcloud won't outrun your ISP.
When to Use a VPS Instead
A Raspberry Pi 5 Nextcloud server doesn't make sense for everyone. Use a VPS if:
- Your upload speed is under 10 Mbps. The server is fast enough; your pipe isn't. A VPS at Hetzner Cloud with 1 Gbps bandwidth solves this instantly for about €4/month.
- You need external collaboration. Sharing files with clients or colleagues who need reliable, fast downloads is painful through a residential connection.
- You travel and need consistent access. A home server depends on your router, your ISP, and your power not going out. A VPS has redundant power and network.
- You don't want to maintain hardware. A €5/month VPS at DigitalOcean or Vultr runs Nextcloud fine for a single user and requires zero hardware troubleshooting.
For pure data sovereignty with large storage (multiple terabytes of photos/video), the Pi wins on cost — spinning up that much block storage on a VPS gets expensive fast. But for lightweight use (calendar, contacts, a few gigs of documents), a VPS is simpler.
Backups
Your self-hosted Nextcloud data is only as safe as your backup. I recommend:
sudo -u www-data php occ maintenance:mode --on
pg_dump nextcloud > /backup/nextcloud-db-$(date +%F).sql
rsync -a /var/www/nextcloud/data/ /backup/nextcloud-data/
sudo -u www-data php occ maintenance:mode --off
Push backups off-site. Backblaze B2 B2 costs $6/TB/month and works well with rclone. Don't skip this — an NVMe failure with no backup means everything is gone.
Who Should NOT Do This
- If you've never used a Linux terminal, start with a VPS and a one-click Nextcloud image. Debugging PHP-FPM on a Pi over SSH during a weekend outage is not fun.
- If you need Nextcloud Office / Collabora for real-time document editing, the Pi 5's quad-core will struggle with more than one or two simultaneous editors. Based on reports from the community, this workload really needs 4+ fast x86 cores.
- If your household has 5+ heavy users syncing simultaneously, you'll hit the limits of 1 Gbps Ethernet and the Pi's CPU.
Verdict
A Pi 5 with NVMe boot is a genuinely practical Nextcloud server for a small household — my build hits