Install Nextcloud on Debian 12

In this guide, we will show you how to Install Nextcloud on Debian 12. Among file-sharing servers, Nextcloud is free and open-source. You can handle tools like Maps, Calendars, document editing, teleconferencing, mailing, and other programs thanks to its centrally located file storage. Data security for files kept on the Nextcloud server is within your control.

Your devices can all be synchronized, and you can even share data with other people. You can even create many accounts for family members and acquaintances. Like any other cloud storage, they’ll be able to log in and store data on the server.

Install Nextcloud on Debian 12

The following steps will guide you on installing Nextcloud on Debian 12.


The following packages are needed in order to install Nextcloud on Debian 12;

  • Apache/Nginx web server.
  • PHP.
  • MySQL/MariaDB Database server.

Update Debian 12 System

Run the following command to update the Debian 12 system before you begin your installation;

sudo apt update && sudo apt upgrade -y

Reboot the system after the update is completed;

sudo reboot now

Install LAMP Stack on Debian 12

In this guide, we will install Nextcloud with Apache web server. Follow our amazing guide on how to install the LAMP Stack(ApacheMariaDB/MySQL, and PHP) on Debian 12;

Install LAMP Stack on Debian 12

Install Other Required PHP Modules on Debian 12

Run the following command to install other PHP Modules;

sudo apt install php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring php-curl php-xml php-pear php-bcmath

Enable Apache Modules;

sudo a2enmod php8.*

Create Nextcloud Database on Debian 12

After completing the LAMP installation, we will proceed to create the Nextcloud database as follows;

Login to MariaDB using the credentials you provided during LAMP installation;

sudo mysql -u root -p

Now, create the database by executing the following commands;

create database ncdb;
grant all privileges on ncdb.* to ncadmin@localhost identified by 'P@ssW0rd';
flush privileges;

Created database;

Install Nextcloud on Debian 12

Download and Install Nextcloud on Debian 12

Navigate to the Nextcloud download’s page to obtain the Archive.

You can also use the wget command to download it;


Extract Nextcloud to Web Root Directory

After obtaining Nextcloud Archive, extract it to the web root directory, /var/www/html/ in our case;

sudo unzip -d /var/www/html/

Set the ownership of the directory to www-data;

sudo chown -R www-data:www-data /var/www/html/nextcloud/
sudo chmod -R 775 /var/www/html/nextcloud/

Configure Apache Webserver for Nextcloud on Debian 12

Create Nextcloud Apache configuration file;

sudo vim /etc/apache2/sites-available/nextcloud.conf

Add the following content to the file created above;

<VirtualHost *:80>
        DocumentRoot "/var/www/html/nextcloud"

        ErrorLog ${APACHE_LOG_DIR}/nextcloud.error
        CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined

        <Directory /var/www/html/nextcloud/>
            Require all granted
            Options FollowSymlinks MultiViews
            AllowOverride All

           <IfModule mod_dav.c>
               Dav off

        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
        Satisfy Any


Enable the Nextcloud virtual host file;

sudo a2ensite nextcloud.conf

Test Apache config file;

sudo apachectl configtest
Syntax OK 

Restart Apache;

sudo systemctl restart apache2

Complete Nextcloud Installation on Debian 12

Navigate to your browser to complete Nextcloud installation. Type http://your-server-ip> and you will get the following page.

Create an admin account;

Install Nextcloud on Debian 12

Configure Nextcloud Database by entering the database details created above and click Install;

Install Nextcloud on Debian 12

Install recommended apps;

Install Nextcloud on Debian 12

All is set, here is Nextcloud Dashboard;

Install Nextcloud on Debian 12


We have come to the end of our guide on how to Install Nextcloud on Debian 12. On using Nextcloud, you will enjoy its amazing features.

Install and Use Docker on Debian 12

Install Latest WordPress with LEMP Stack on Debian 12

Install Nextcloud on Ubuntu 22.04

Install Xrdp server on Rocky Linux

Leave a Comment