DropVPS Team
Writer: Cooper Reagan
How to Install Nextcloud on Debian 13

Table of Contents
Nextcloud is a powerful self-hosted cloud platform for file syncing, backups, collaboration, and secure personal or business data. Debian 13 (Trixie) makes installation stable and clean with Apache, PHP, and MariaDB.
Step 1: Update System Packages
Start with a fully updated Debian system.
sudo apt update && sudo apt upgrade -y
Step 2: Install Apache Web Server
Nextcloud works seamlessly with Apache.
sudo apt install apache2 -y
sudo systemctl enable --now apache2
Check status:
systemctl status apache2
Step 3: Install PHP and Required Extensions
Nextcloud depends on several PHP modules. Install everything in one command:
sudo apt install -y php php-fpm php-cli php-common php-mysql php-xml php-zip php-gd php-curl php-mbstring php-intl php-bcmath php-gmp php-imagick php-redis
Restart Apache:
sudo systemctl restart apache2
Check PHP version:
php -v
Step 4: Install MariaDB Server
Nextcloud uses MySQL/MariaDB as its database backend:
sudo apt install mariadb-server -y
sudo systemctl enable --now mariadb
Secure the installation:
sudo mysql_secure_installation
Step 5: Create Nextcloud Database and User
Log into MariaDB:
sudo mysql -u root
Run:
CREATE DATABASE nextcloud;
CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 6: Download and Configure Nextcloud
Go to /var/www/ and download the latest Nextcloud release:
cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/latest.zip
sudo apt install unzip -y
sudo unzip latest.zip
sudo chown -R www-data:www-data nextcloud
sudo chmod -R 755 nextcloud
Step 7: Configure Apache Virtual Host
Create the configuration file:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Add:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
ErrorLog ${APACHE_LOG_DIR}/nextcloud-error.log
CustomLog ${APACHE_LOG_DIR}/nextcloud-access.log combined
</VirtualHost>
Enable site + modules:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime
sudo systemctl reload apache2
Step 8: Run the Nextcloud Web Installer
Open your browser and visit:
http://your-server-ip/
Or:
http://your-domain.com/
Fill in:
-
Admin username & password
-
Database: nextcloud
-
DB user: ncuser
-
Password: (your DB password)
-
Host: localhost
Then click Finish Setup.