Published 2025-10-10 by Josue Valentin
This guide describes a complete Nextcloud installation using Apache, MariaDB, and PHP-with HTTPS managed externally (through Cloudflare, Nginx proxy, or a load balancer).
System Preparation
Start by updating your system and installing required packages:
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server libapache2-mod-php \\
php php-cli php-mysql php-gd php-xml php-curl php-zip \\
php-mbstring php-intl php-bcmath php-imagick unzip curl -y
Enable Apache Modules
sudo a2enmod rewrite headers env dir mime
sudo systemctl restart apache2
Configure MariaDB
sudo mysql_secure_installation
sudo mysql -u root -p
Create the database and user:
CREATE DATABASE nextcloud;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'your-password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Download and Install Nextcloud
cd /var/www
sudo wget https://download.nextcloud.com/server/releases/latest.zip
sudo unzip latest.zip
sudo chown -R www-data:www-data /var/www/nextcloud
Configure Apache Virtual Host
Create a new Apache configuration file for Nextcloud with appropriate settings for your reverse proxy setup.
For complete configuration details and troubleshooting, contact our team for assistance.