Skip to content

Set Up Nextcloud on a Linux Server – Build Your Private Cloud

Set up Nextcloud on your Linux VPS and create your own private cloud for files, calendars, and more → Learn more now

10 November 20267 min read0 Views0 helpful

Introduction

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.

Preparation

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.

Hardware

ComponentsMinimumRecommended
CPU1x 2 GHz4x 2+ GHz
RAM1 GB4+ GB
Storage10 GB50+ GB (depending on stored data volume)
Bandwidth100 Mbit/s (Up & Down)500 Mbit/s (Up & Down), recommended if multiple users use the cloud

Software

PlatformOptions
Operating SystemUbuntu (22.04, 24.04), Debian (12, 13)
DatabaseMariaDB 10.11+ (recommended), PostgreSQL 14+, MySQL 8.0+, SQLite (only for testing and minimal setups)
Web ServerApache 2.4 with mod_php or php-fpm (recommended), alternatively Nginx with php-fpm
PHP8.3, 8.4, 8.5 (recommended)
Info

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):

Code
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):

Code
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):

Code
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):

Code
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:

Code
php -v
Info

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:

Code
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:

sql
mysql -u root -p
CREATE DATABASE nextcloud;

Then create a user with access to the Nextcloud database:

sql
CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
Info

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:

sql
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';
FLUSH PRIVILEGES;

When finished, exit the database with exit and continue with the next steps.

MySQL

Install package:

Code
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:

sql
mysql -u root -p
CREATE DATABASE nextcloud;

Then create a user with access to the Nextcloud database:

sql
CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
Info

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:

sql
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';
FLUSH PRIVILEGES;

When finished, exit the database with exit and continue with the next steps.

PostgreSQL

Install packages:

Code
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Next, connect to the database server and create the database and user:

sql
sudo -u postgres psql
CREATE USER nc_user WITH ENCRYPTED PASSWORD 'YOUR_PASSWORD_HERE';
CREATE DATABASE nextcloud OWNER nc_user;
Info

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
<?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:

Code
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
<?php
$CONFIG = array(
  'dbtype'        => 'sqlite3',
  'dbname'        => 'nextcloud',
  'dbtableprefix' => '',
);

FAQ

Frequently asked questions

The easiest way is using One-Click Apps in the VPS web interface, where Nextcloud is available as a ready-made entry from the integrated Coolify App Marketplace. Alternatively, the guide also covers manual installation.
Nextcloud is an open-source cloud solution and a fork of ownCloud that lets you run your own private cloud for files, calendars, contacts, chat, and video calls—fully under your own control.
No, the Nextcloud server is not compatible with Windows or macOS, at least not without additional virtualization or similar workarounds.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 Users found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.