Updated: 28 September 2026 · Applies to: Nextcloud 35 on Ubuntu 24.04 (PHP 8.3)

Ubuntu 16.04 is end of life. Nextcloud is a self-hosted file sync and sharing platform, like Dropbox, with calendars, contacts and collaboration apps. This guide uses Ubuntu 24.04.

The current version is Nextcloud 35. It needs PHP 8.3 or newer and MariaDB 10.11+, MySQL 8.4 or PostgreSQL 14+. The simplest option is Nextcloud All-in-One with Docker (see "How to install Nextcloud on your server with Docker?"); the manual installation on Ubuntu 24.04 is below.

Before you start

  • A VPS or dedicated server with a fresh Ubuntu 24.04 / Debian 12 or AlmaLinux 9 / Rocky Linux 9 installation, and root or sudo access.
  • A domain or subdomain pointing to the server (an A record), if you want HTTPS.
  • The system updated: apt update && apt upgrade or dnf upgrade.

Install Apache, MariaDB and PHP

Ubuntu 24.04 / Debian 12:

apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-xml php-mbstring php-curl php-zip php-gd php-intl
systemctl enable --now apache2 mariadb

AlmaLinux 9 / Rocky Linux 9 (choose a current PHP stream first):

dnf module reset php && dnf module enable php:8.3
dnf install httpd mariadb-server php php-fpm php-mysqlnd php-xml php-mbstring php-gd php-intl php-opcache php-pecl-zip
systemctl enable --now httpd mariadb php-fpm

Secure MariaDB (set a root password or keep socket login, remove test data): mariadb-secure-installation.

Also install: apt install php-gd php-curl php-zip php-xml php-mbstring php-intl php-bcmath php-gmp php-imagick php-apcu php-redis redis-server unzip (Ubuntu/Debian) and restart Apache.

Create a database

mariadb -u root -p
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'Strong-Password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download Nextcloud

cd /var/www
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip            # creates /var/www/nextcloud
mkdir -p /var/nc-data
chown -R www-data:www-data /var/www/nextcloud /var/nc-data

Create the Apache site

Create /etc/apache2/sites-available/cloud.example.com.conf (Ubuntu/Debian) or /etc/httpd/conf.d/cloud.example.com.conf (AlmaLinux/Rocky):

<VirtualHost *:80>
    ServerName cloud.example.com
    ServerAlias www.cloud.example.com
    DocumentRoot /var/www/nextcloud
    <Directory /var/www/nextcloud>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Ubuntu/Debian: a2ensite cloud.example.com && a2enmod rewrite && systemctl reload apache2. AlmaLinux/Rocky: apachectl configtest && systemctl reload httpd.

Enable the Apache modules Nextcloud uses: a2enmod rewrite headers env dir mime && systemctl reload apache2.

Add a free SSL certificate

apt install certbot python3-certbot-apache                     # Ubuntu / Debian
dnf install epel-release && dnf install certbot python3-certbot-apache   # AlmaLinux / Rocky
certbot --apache -d example.com -d www.example.com

Certbot installs a timer that renews the certificate automatically; test it with certbot renew --dry-run.

Run the installer

Open https://cloud.example.com, create the admin account, set the data folder to /var/nc-data (outside the web folder), and enter the database details.

After installation

  • Set PHP memory_limit to at least 512M and enable OPcache.
  • Use cron for background jobs: in Administration settings › Basic settings choose Cron and add */5 * * * * php -f /var/www/nextcloud/cron.php to the www-data crontab.
  • Add memory caching (APCu and Redis) in config/config.php, and fix the warnings shown under Administration settings › Overview.

Tip: On Ucartz cPanel hosting you can install many of these applications in a few clicks with Software › Softaculous Apps Installer, which also handles updates and backups.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)