Nextcloud is an open-source cloud solution and a fork of ownCloud, founded in 2016 by former ownCloud founder Frank Karlitschek. With Nextcloud, you run your own private cloud for files, calendars, contacts, chat, and video calls—completely under your own control instead of relying on a third-party provider.
To ensure optimal performance, stability, and functionality, we recommend the following setup for hosting a Nextcloud server. The Nextcloud server is not compatible with Windows or macOS, at least not without additional virtualization or similar workarounds.
The following requirements are based on the official Nextcloud system requirements as well as our own experience. If you do not meet these prerequisites, problems may occur.
| Components | Minimum | Recommended |
|---|---|---|
| CPU | 1x 2 GHz | 4x 2+ GHz |
| RAM | 1 GB | 4+ GB |
| Storage | 10 GB | 50+ GB (depending on stored data volume) |
| Bandwidth | 100 Mbit/s (Up & Down) | 500 Mbit/s (Up & Down), recommended if multiple users use the cloud |
| Platform | Options |
|---|---|
| Operating System | Ubuntu (22.04, 24.04), Debian (12, 13) |
| Database | MariaDB 10.11+ (recommended), PostgreSQL 14+, MySQL 8.0+, SQLite (only for testing and minimal setups) |
| Web Server | Apache 2.4 with mod_php or php-fpm (recommended), alternatively Nginx with php-fpm |
| PHP | 8.3, 8.4, 8.5 (recommended) |
For the latest requirements, check the official Nextcloud documentation – Nextcloud regularly updates its PHP and database requirements with new major releases.
To install the cloud on a Linux server, you need to connect via an SSH client. If you are unsure how SSH works, here is a guide: First Access (SSH)
Once connected, you can install the necessary packages required for the actual Nextcloud installation. This includes installing a web server and PHP along with the Nextcloud-required extensions (e.g., gd, curl, mbstring, xml, zip, intl, bcmath, gmp, apcu).
Apache (Web Server) and PHP
🗄️ Ubuntu 24.04 (ships with PHP 8.3 directly):
sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 php php-cli php-fpm php-common php-mysql php-pgsql php-sqlite3 php-zip php-gd php-mbstring php-curl php-xml php-bcmath php-intl php-gmp php-imagick php-apcu
🗄️ Ubuntu 22.04 (default PHP is 8.1, too old for current Nextcloud versions – PPA needed):
sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt -y install php8.3 php8.3-cli php8.3-fpm php8.3-common php8.3-mysql php8.3-pgsql php8.3-sqlite3 php8.3-zip php8.3-gd php8.3-mbstring php8.3-curl php8.3-xml php8.3-bcmath php8.3-intl php8.3-gmp php8.3-imagick php8.3-apcu
🗄️ Debian 13 “trixie” (ships with PHP 8.3 directly):
sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 php php-cli php-fpm php-common php-mysql php-pgsql php-sqlite3 php-zip php-gd php-mbstring php-curl php-xml php-bcmath php-intl php-gmp php-imagick php-apcu
🗄️ Debian 12 “bookworm” (default PHP is 8.2, too old for current Nextcloud versions – third-party repo needed):
sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 lsb-release apt-transport-https ca-certificates wget
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt -y install php8.3 php8.3-cli php8.3-fpm php8.3-common php8.3-mysql php8.3-pgsql php8.3-sqlite3 php8.3-zip php8.3-gd php8.3-mbstring php8.3-curl php8.3-xml php8.3-bcmath php8.3-intl php8.3-gmp php8.3-imagick php8.3-apcu
Check PHP version:
php -v
Nextcloud requires memory_limit = 512M or higher. Set this value in the appropriate php.ini (e.g., /etc/php/8.3/apache2/php.ini or /etc/php/8.3/fpm/php.ini) and then restart Apache or PHP-FPM.
The next step is to choose a database type to store Nextcloud data. Pick one of the following options and follow only the steps for your choice.
Install package:
sudo apt-get install mariadb-server
During installation, you will be prompted to set a root password. If no password prompt appears, the default password is empty. This is insecure and should be changed immediately!
Next, connect to the database server and create the required database:
mysql -u root -p
CREATE DATABASE nextcloud;
Then create a user with access to the Nextcloud database:
CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
Do not skip this step by using the root user. This is insecure and endangers your data!
Finally, grant the new user the necessary privileges:
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';
FLUSH PRIVILEGES;
When finished, exit the database with exit and continue with the next steps.
Install package:
sudo apt-get install mysql-server
During installation, you will be prompted to set a root password. If no password prompt appears, the default password is empty. This is insecure and should be changed immediately!
Next, connect to the database server and create the required database:
mysql -u root -p
CREATE DATABASE nextcloud;
Then create a user with access to the Nextcloud database:
CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
Do not skip this step by using the root user. This is insecure and endangers your data!
Finally, grant the new user the necessary privileges:
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';
FLUSH PRIVILEGES;
When finished, exit the database with exit and continue with the next steps.
Install packages:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
Next, connect to the database server and create the database and user:
sudo -u postgres psql
CREATE USER nc_user WITH ENCRYPTED PASSWORD 'YOUR_PASSWORD_HERE';
CREATE DATABASE nextcloud OWNER nc_user;
Do not skip this step by using the postgres superuser for Nextcloud itself. This is insecure and endangers your data!
When finished, exit the database with \q. Enter the PostgreSQL connection details either in the web installer or directly in the config.php:
<?php
$CONFIG = array(
'dbtype' => 'pgsql',
'dbname' => 'nextcloud',
'dbuser' => 'nc_user',
'dbpassword' => 'YOUR_PASSWORD_HERE',
'dbhost' => 'localhost',
'dbtableprefix' => '',
);
SQLite is only suitable for testing or very small single-user instances – Nextcloud developers strongly advise against it for productive multi-user environments (due to lack of concurrency with parallel access).
Install packages:
sudo apt-get install sqlite3 php8.3-sqlite3
Nextcloud automatically creates the SQLite database file during installation; no manual database creation is needed. The configuration in config.php looks like this:
<?php
$CONFIG = array(
'dbtype' => 'sqlite3',
'dbname' => 'nextcloud',
'dbtableprefix' => '',
);
