Blogging Knowledge Base

How to Install NextCloud on Ubuntu 24.04? – Brief Guide 2026

Managing your own cloud storage has become more than just a trend, it’s a necessity for privacy, performance, and complete data control. Nextcloud stands out as one of the most powerful open-source cloud platforms, allowing you to host files, collaborate with teams, sync devices, and replace third-party services like Google Drive or Dropbox entirely. When paired with Ubuntu 24.04 LTS, you get a rock-solid, long-term supported operating system that’s ideal for building a secure and future-proof cloud environment.

Here, we’ll walk you through how to install Nextcloud on Ubuntu 24.04 LTS step by step, using best-practice configurations for performance, security, and stability. Whether you’re setting up Nextcloud on a VPS, a dedicated server, or a local machine, this guide is written to be beginner-friendly while still covering important technical details that system administrators care about.

By the end of this tutorial, you’ll have a fully functional self-hosted Nextcloud server running on Ubuntu 24.04, ready for production use. No unnecessary jargon, no skipped steps—just a clean, practical installation process that works in real-world environments. Let’s get started and build your own private cloud the right way. 🚀


Install Nextcloud on Ubuntu 24.04 LTS

Looking to install Nextcloud on Ubuntu 24.04 LTS and build a private, secure, and fast file-sync cloud? This complete 2026 guide walks you through a clean, production-grade setup using

Apache, PHP 8.3, MariaDB, HTTPS, Redis caching, and cron. It’s written for beginners, but follows best practices I use when deploying Nextcloud for clients at scale.

How to Install NextCloud on Ubuntu

Primary keyword target: Install Nextcloud on Ubuntu 24.04 LTS. Secondary keywords included naturally: Nextcloud installation guide 2026, Ubuntu 24.04 Apache PHP 8.3, Let’s Encrypt SSL, MariaDB, Redis locking.


What You’ll Build (and Why It’s Production-Ready)

  • Web server: Apache 2.4 with HTTP/2 and PHP 8.3-FPM
  • Database: MariaDB 10.11 LTS (or MySQL 8/PostgreSQL if you prefer)
  • App: Latest stable Nextcloud (Hub), deployed in /var/www/nextcloud
  • HTTPS: Free TLS via Let’s Encrypt with HSTS
  • Performance: APCu (local cache) and Redis (locking/memcache)
  • Reliability: System cron every 5 minutes for background jobs
  • Security: Firewall (UFW), hardened PHP, trusted domains

Prerequisites

  • Fresh Ubuntu 24.04 LTS server with sudo access
  • Domain pointed to your server (e.g., cloud.example.com via A/AAAA DNS)
  • Ports 80 and 443 open (firewall/security group)
  • At least 2 vCPU, 4 GB RAM, and fast SSD/NVMe storage for small teams

Tip: If you’d like a tuned VPS for Nextcloud with NVMe, dedicated IPv4, and 24/7 support, QloudHost can provision Ubuntu 24.04 LTS in minutes and pre-harden it for production.

Step-by-Step: Install Nextcloud on Ubuntu 24.04 LTS

Step 1 — Update server and base packages


Step 2 — Install Apache, PHP 8.3-FPM, and required PHP modules

Why PHP-FPM? It’s faster and more scalable than mod_php, especially under concurrent loads. Enabling HTTP/2 improves performance for browsers and clients.


Step 3 — Install MariaDB and create the Nextcloud database

utf8mb4 ensures proper support for emojis and international characters. Use a strong, unique password.


Step 4 — Download Nextcloud and set permissions

Optional but recommended: Keep data outside webroot for clarity and backups.


Step 5 — Configure Apache VirtualHost for Nextcloud

Step 6 — Enable firewall and HTTPS with Let’s Encrypt

sudo ufw allow OpenSSH
sudo ufw allow "Apache Full"
sudo ufw enable
sudo apt -y install certbot python3-certbot-apache
sudo certbot --apache -d cloud.example.com --redirect --hsts --staple-ocsp \
--email admin@example.com --agree-tos
sudo certbot renew --dry-run

HSTS prevents protocol downgrade; the OCSP stapling flag helps browsers validate certificates faster.


Step 7 — Run the web installer

Visit https://cloud.example.com and create an admin account. For data folder, choose /var/ncdata. Enter database: nextcloud, user: ncuser, password: your password, host: localhost. Finish setup.


Step 8 — Configure caching (APCu + Redis) and trusted domain

After the installer completes, add caching and domain settings for performance and security.


Step 9 — Switch background jobs to cron

In Settings → Basic settings, set “Cron” as the background job mode. This ensures timely file scans, cleanup, and app tasks.


Post-Install Optimization

Tune PHP 8.3 for Nextcloud


Enable HTTP/2 and gzip/brotli (Apache)

We enabled http2 already. For compression, enable deflate; brotli can be added if you install mod_brotli.


Security Hardening

  • Force HTTPS and HSTS (already enabled by Certbot).
  • Use strong admin passwords and per-user app passwords.
  • Keep Ubuntu, PHP, and Nextcloud updated.
  • Restrict SSH: key-based auth, non-default port if needed, fail2ban.
  • Backups: database (mysqldump) + data directory (rsync) + config.php.

Troubleshooting Common Issues

  • White page or 500 error: Check /var/log/apache2/nextcloud_error.log and php-fpm logs with journalctl -u php8.3-fpm.
  • “Can’t write into data directory”: Fix ownership with chown -R www-data:www-data /var/ncdata.
  • Missing modules warning: apt install the indicated php8.3- extensions, then restart PHP-FPM.
  • DB connection failed: Confirm credentials and that the user has privileges on the nextcloud database.
  • Background jobs not running: Verify the www-data crontab and that cron service is active.

Maintenance and Updates

  • Check status: sudo -u www-data php /var/www/nextcloud/occ status
  • Run updater: sudo -u www-data php /var/www/nextcloud/updater/updater.phar
  • Update apps: Nextcloud web UI → Apps
  • OS updates: sudo apt update && sudo apt -y upgrade
  • Backups before upgrades: database + data + config.php

Real-World Tips From the Field

  • Start with MariaDB for simplicity; choose PostgreSQL for very large instances or complex reporting.
  • Use APCu for local cache and Redis for locking to prevent file locking errors under heavy concurrency.
  • Avoid the snap for production where you need fine-grained control and maximum performance.
  • Plan storage: OS disk for app, separate volume for /var/ncdata (snapshots/backups become easier).
  • For more than 100 users or heavy Preview generation, size up CPU/RAM and use Redis with enough memory.

If you don’t want to manage this stack yourself, QloudHost offers managed VPS and dedicated solutions pre-optimized for Nextcloud on Ubuntu 24.04 LTS, including monitoring, backups, and SLA-backed support.


Optional: Nginx Server Block (If You Prefer Nginx)

Apache is great for simplicity and .htaccess rules. If you prefer Nginx, ensure you translate rewrites and PHP-FPM handling correctly. Here’s a minimal template:

Then enable HTTPS with certbot –nginx. Validate with nginx -t and systemctl reload nginx.


FAQs: Install Nextcloud on Ubuntu 24.04 LTS

Is this Nextcloud installation guide valid for 2026?

Yes. Ubuntu 24.04 LTS is supported long-term, PHP 8.3 is stable, and these steps align with Nextcloud’s best practices. Always use the latest Nextcloud release (latest.tar.bz2) and keep packages updated.

Should I use MariaDB, MySQL, or PostgreSQL?

MariaDB is the easiest starting point. MySQL 8 works well too. PostgreSQL is excellent for large-scale setups. Performance differences are minor for small teams; choose the database your team can manage confidently.

How do I increase the Nextcloud upload size?

Increase PHP limits in php.ini (upload_max_filesize, post_max_size) and ensure your web server (Apache/Nginx) client body size is set accordingly. Then restart PHP-FPM and reload your web server.

Is Docker better than a native install?

Docker simplifies portability and app isolation, but adds orchestration complexity. For single-host, small-to-mid setups, native Ubuntu is straightforward and fast. For HA and scaling, containers can help—ensure you manage volumes, backups, and updates properly.

Why do I need Redis for Nextcloud?

Redis handles file locking and distributed cache, preventing race conditions and 500 errors during concurrent operations. It significantly improves reliability and performance, especially with many users or large files.

Conclusion

Installing Nextcloud on Ubuntu 24.04 LTS is a smart move if you want full control over your data, better performance, and long-term stability. With Ubuntu’s extended support and Nextcloud’s constantly evolving ecosystem, this setup is perfectly suited for personal use, businesses, and production environments well beyond 2026.

By following this guide step by step, you’ve successfully deployed a secure and self-hosted cloud platform that can handle file storage, collaboration, backups, and team workflows without relying on third-party services. From configuring the web server and database to securing your installation and optimizing performance, every step was designed to give you a reliable Nextcloud instance you can trust.

To get the most out of your Nextcloud server, keep it updated, enable recommended security features, and monitor system resources regularly. As your needs grow, you can further enhance your setup with caching, external storage, and app integrations. With the right maintenance and scaling approach, your Nextcloud installation on Ubuntu 24.04 LTS will remain fast, secure, and future-ready for years to come. 🚀

Leave a Comment