If you've ever wanted your own private Google Drive — one that lives in your house, not on someone else's server — Nextcloud is probably the tool you've heard about. It's the most popular self-hosted alternative to Dropbox and Google Drive, and running it in a Proxmox VE LXC container is one of the cheapest, lightest ways to get it going.
This guide walks you through building that container from scratch: the web server, the database, PHP, and Nextcloud itself. No Docker, no prebuilt appliance, just a plain Debian container and the same install steps a lot of production Nextcloud servers actually use.
What You Will Learn
By the end of this tutorial you'll have a working Nextcloud instance running in an LXC container on your Proxmox VE host, reachable from any device on your network. Specifically, you'll learn how to:
- Create a properly sized LXC container for Nextcloud
- Install and configure Apache, MariaDB, and PHP on Debian 12
- Download and install Nextcloud manually, without Docker or a helper script
- Fix the two or three errors almost everyone hits during setup
- Set up a cron job so Nextcloud stops nagging you about background tasks
What Is This Feature?
Nextcloud is open-source software that gives you file storage, syncing, calendars, contacts, and document editing, all running on hardware you control. Install the desktop or mobile app, and it behaves almost exactly like Dropbox — drop a file in a folder and it shows up on your other devices. The difference is that the files never leave your network unless you want them to.
An LXC container, if you haven't run into the term yet, is Proxmox VE's lightweight alternative to a full virtual machine. Instead of emulating an entire computer, it shares the host's Linux kernel and only isolates the processes and filesystem. That means it starts in under a second, uses a fraction of the RAM a VM would need, and is a great fit for a single-purpose app like Nextcloud.
Why Would You Use It?
Cloud storage subscriptions add up. Nextcloud doesn't get more expensive as you add storage — you're limited by your own disk, not a monthly quota. It also stays useful long after you outgrow "just file syncing." Once it's running, you can layer on calendar sync (replacing Google Calendar), contacts sync, a basic office suite for editing documents in the browser, and a phone backup target for photos.
Running it in an LXC container instead of a VM keeps resource usage low enough that a homelab box with a handful of other services can still handle it comfortably. You get a real Linux install with full apt access — useful when you want to tweak PHP settings or add a caching layer later — without the overhead of virtualizing a whole kernel.
Prerequisites
Before you start, make sure you have:
- A working Proxmox VE 8.x host (this also works fine on 9.x) with internet access
- A Debian 12 (Bookworm) container template downloaded — grab it from local (Templates) in the web UI if you don't already have it
- At least 4 GB of RAM you can spare for the container (2 GB will technically boot Nextcloud, but MariaDB and PHP get sluggish under real usage)
- At least 16 GB of disk space if you plan to store more than a handful of files — 8 GB is enough for the OS and Nextcloud itself, but your actual files need room too
- Root or sudo access inside the container, and basic comfort typing commands in a terminal
You don't need a domain name or SSL certificate to follow this guide. I'll get you to a working Nextcloud instance on your local network first — adding HTTPS and remote access is a separate step I'll point you toward at the end.
Step-by-Step Tutorial
Step 1: Create the LXC container
In the Proxmox VE web interface, right-click your node and choose Create CT. Work through the wizard tabs:
- General: give it a hostname like
nextcloudand set a root password (or paste an SSH public key instead) - Template: pick the debian-12-standard template
- Disks: set at least 16 GB — you can always grow this later, but shrinking a disk later is a much bigger hassle
- CPU: 2 cores is plenty to start
- Memory: 4096 MB, with swap left at the default
- Network: bridge
vmbr0, and either DHCP or a static IP — a static IP is worth setting here since you'll be typing this address into a browser regularly
Leave the container unprivileged. Nextcloud doesn't need direct hardware access, so there's no reason to weaken the container's isolation for it. Start the container once the wizard finishes, then open its console.
Step 2: Update the system and install the web stack
Log in as root and update the package list first:
apt update && apt upgrade -y
Now install Apache, MariaDB, and the PHP modules Nextcloud needs:
apt install -y apache2 mariadb-server libapache2-mod-php php-gd php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-bcmath php-gmp unzip wget
That's a long line, but each package earns its place — you'll see why in the Commands Explained section below. On a typical connection this whole step takes two or three minutes.
Step 3: Create the Nextcloud database
Nextcloud needs a database to store user accounts, file metadata, and settings — the actual files are stored separately on disk. Run MariaDB's setup script first:
mysql_secure_installation
Set a root password when it asks, and answer yes to the remaining prompts (remove anonymous users, disable remote root login, remove the test database). Then create the Nextcloud database and a dedicated user for it:
mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'ChangeThisPassword123';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Pick a real password here, obviously — you'll type it once more during the Nextcloud setup wizard and then never again.
Step 4: Download and extract Nextcloud
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip -d /var/www/
chown -R www-data:www-data /var/www/nextcloud
latest.zip is a permanent link Nextcloud maintains that always points at the newest stable release, so you don't need to hunt down a version number. The chown step matters more than it looks — Apache runs as the www-data user, and Nextcloud won't be able to write its own config file or store uploads if that user doesn't own the directory.
Step 5: Configure Apache
Create a new site config:
nano /etc/apache2/sites-available/nextcloud.conf
Paste in:
<VirtualHost *:80>
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
Save the file, then enable the site along with the Apache modules Nextcloud depends on:
a2ensite nextcloud.conf
a2enmod rewrite headers env dir mime unique_id
a2dissite 000-default.conf
systemctl restart apache2
Step 6: Run the setup wizard
Open a browser on any device on your network and go to http://<your-container-ip>/. You should land on the Nextcloud setup screen. Create an admin username and password, then click Storage & database and switch from SQLite to MySQL/MariaDB. Enter the database name, username, and password you created in Step 3, with localhost as the database host. Click Finish setup and give it a minute — it's building out the database tables and default folders.
Step 7: Fix trusted domains and set up cron
Nextcloud only accepts requests to hostnames you've explicitly allowed, and it defaults to whatever address you used during setup. If you plan to reach it by a different IP, a hostname, or both, edit the config:
nano /var/www/nextcloud/config/config.php
Find the trusted_domains array and add every address you'll use:
'trusted_domains' =>
array (
0 => '192.168.1.50',
1 => 'nextcloud.local',
),
Then set up the cron job. By default Nextcloud tries to run background maintenance tasks (like the recycle bin cleanup and file scanning) via AJAX whenever someone loads a page, which is unreliable. A real cron job is much better:
crontab -u www-data -e
Add this line:
*/5 * * * * php -f /var/www/nextcloud/cron.php
Then go to Settings > Administration > Basic settings in the Nextcloud web interface and switch Background Jobs from AJAX to Cron. That's the whole install — you now have a working Nextcloud server.
Commands Explained
A quick rundown of what you actually installed, since the apt line in Step 2 was dense:
apache2— the web server that actually serves Nextcloud's pages to your browsermariadb-server— the database engine that stores accounts, share links, and file metadatalibapache2-mod-php— lets Apache execute Nextcloud's PHP code instead of just sending it as a text filephp-gdandphp-imagick— generate thumbnails and previews for photosphp-mysql— the driver that lets PHP talk to MariaDBphp-curl— used for federated sharing and connecting to external servicesphp-mbstring,php-intl,php-xml— handle text encoding, language formatting, and file parsingphp-zip— needed to open and create ZIP archives from within the file browserphp-bcmath,php-gmp— math libraries used by Nextcloud's encryption and sharing features
mysql_secure_installation is a script bundled with MariaDB that closes off the default insecure settings — blank root passwords, test databases, remote root login — that are fine for a five-minute demo and bad for anything you're actually going to use.
Common Errors
A few things trip up almost everyone on the first attempt:
"Access through untrusted domain" — you'll see this the moment you access Nextcloud by an address you didn't use during initial setup. It's not a bug, it's the trusted_domains check from Step 7. Add the address to config.php and it goes away immediately.
A blank white page after finishing the setup wizard — almost always a missing PHP module. Check /var/log/apache2/error.log for the specific extension it's complaining about, install it with apt, and restart Apache.
"Failed to connect to the database" during setup — double-check you typed the database name and password exactly as you created them in Step 3. A stray space when pasting a password is a common culprit.
Uploads failing above a few megabytes — this is a PHP limit, not a Nextcloud one. Edit /etc/php/8.2/apache2/php.ini and raise upload_max_filesize and post_max_size (both default to 2M or so on Debian), then restart Apache.
Troubleshooting
If the setup wizard never loads at all, check that Apache is actually running with systemctl status apache2, and confirm you can reach the container's IP from your browser with a simple ping first — LXC networking issues are usually a DHCP lease that didn't get assigned, not a Nextcloud problem.
If pages load but look broken, with no CSS applied, that's usually the rewrite or headers Apache module not being enabled. Re-run the a2enmod command from Step 5 and restart Apache — it's easy to skip this step by accident since Apache doesn't error out when a module is missing, it just quietly serves things wrong.
Run the built-in health check any time something feels off:
sudo -u www-data php /var/www/nextcloud/occ status
The occ command is Nextcloud's own command-line tool, and running it as www-data matters — run it as root and it'll change file ownership on your config in ways that cause permission errors later.
Best Practices
Take a snapshot of the container right after you finish the setup wizard, before you start adding users and files. It's a two-second safety net if a future update goes sideways.
Don't skip the cron switch in Step 7. Leaving background jobs on AJAX means they only run when someone happens to be browsing Nextcloud, which means file scanning and cleanup tasks can silently stall for days on a lightly used instance.
Keep Nextcloud itself updated through its own built-in updater (under Settings > Administration > Overview) rather than trying to replace files manually — it handles the database migrations that come with version upgrades. Debian's apt only needs to keep the underlying OS and PHP patched.
If you're storing anything you actually care about, back up the container the same way you'd back up a VM — a scheduled vzdump job covers both the Nextcloud install and the database in one pass.
Frequently Asked Questions
Do I need a domain name to use Nextcloud?
No. Everything in this guide works fine over your local network using just an IP address. A domain only matters if you want to access Nextcloud from outside your home, which also means you'll want HTTPS.
Can I run Nextcloud in a VM instead of an LXC container?
Yes, and the install steps are identical once you're inside the guest OS. The container just uses less RAM and disk for the same result, which is why it's the better default for a single app like this.
Is SQLite really not good enough?
It'll work for testing, but Nextcloud's own documentation recommends MariaDB or PostgreSQL for anything with more than a couple of users, since SQLite handles concurrent access poorly and gets noticeably slower as your file count grows.
How much storage will I actually need?
That depends entirely on what you're syncing. Photos and videos from a few phones can easily hit 100+ GB over time, so size the container's disk — or better, a separate mounted data directory — based on what you plan to store, not just the OS footprint.
Why does the Nextcloud admin panel show a security warning about HTTPS?
Because you're running over plain HTTP, which Nextcloud flags as insecure by design. It's expected on a local-network-only setup like this one and isn't something to worry about until you're exposing it to the internet.
Conclusion
You've now got a self-hosted Nextcloud instance running in a lightweight LXC container, backed by a real database instead of a quick-and-dirty SQLite file. It's the same stack a lot of small production deployments use, just sized down for a homelab.
From here, the natural next steps are setting up the desktop sync client on your computers, the mobile app for automatic photo backup, and — once you're comfortable with the basics — a reverse proxy with a Let's Encrypt certificate if you want to reach it securely from outside your home network.