Updated: 28 September 2026 · Applies to: Nextcloud 35 on Ubuntu 24.04 (PHP 8.3)
Debian 9 and Nextcloud 15 are end of life. Debian 12 ships PHP 8.2, which current Nextcloud versions no longer support, so on Debian 12 use Nextcloud All-in-One (Docker), or install on Ubuntu 24.04 as shown below.
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 upgradeordnf 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_limitto 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.phpto thewww-datacrontab. - Add memory caching (APCu and Redis) in
config/config.php, and fix the warnings shown under Administration settings › Overview.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
