How to Install Nextcloud on Debian 13

Nextcloud is an open source software that enables secure storage, collaboration, and sharing. Nextcloud runs on your own server, protecting your data and giving you access from your desktop or mobile devices. You can synchronize everything between your devices and share files with others as well.

Install the Required Packages

Nextcloud is a PHP web application. It requires PHP, a web server (Apache), and a database (MariaDB).

Update the package index.

apt update

Install Apache, MariaDB, PHP and the required PHP extensions.

apt install apache2 libapache2-mod-php mariadb-server php php-cli php-common php-mysql php-gd php-curl php-mbstring php-intl php-imagick php-xml php-zip unzip wget -y

Start and enable Apache.

systemctl start apache2

systemctl enable apache2

Verify Apache is running.

systemctl status apache2

Output:

root@server:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: active (running)

Configuring your Database

Secure the MariaDB installation.

mariadb-secure-installation

Login to MariaDB.

mysql -u root -p

Create a database for Nextcloud.

CREATE DATABASE nextcloud;

Create a database user.

CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'StrongPassword';

Replace StrongPassword with a secure password of your choice.

Grant the required permissions.

GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';

Flush the privileges and exit MariaDB.

FLUSH PRIVILEGES;

EXIT;

Download Nextcloud

Navigate to the /tmp directory.

cd /tmp

Download the latest Nextcloud release.

wget https://download.nextcloud.com/server/releases/latest.zip

Output:

root@server:/tmp# wget https://download.nextcloud.com/server/releases/latest.zip
Saving to: 'latest.zip'
latest.zip          100%[===================>] 271.85M  94.3MB/s    in 2.9s

Install Nextcloud

Extract the downloaded archive.

unzip latest.zip

Move the extracted directory to the Apache document root.

mv nextcloud /var/www/html/

Set the correct ownership.

chown -R www-data:www-data /var/www/html/nextcloud

Set the recommended permissions.

find /var/www/html/nextcloud/ -type d -exec chmod 750 {} \;

find /var/www/html/nextcloud/ -type f -exec chmod 640 {} \;

Configure Apache

Create a VirtualHost configuration.

cat > /etc/apache2/sites-available/nextcloud.conf << 'EOF'
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/nextcloud

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

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>
EOF

Enable the required Apache modules.

a2enmod rewrite headers env dir mime ssl

Enable the Nextcloud site.

a2ensite nextcloud.conf

Disable the default Apache site.

a2dissite 000-default.conf

Restart Apache.

systemctl restart apache2

Complete the Installation

Open your browser and navigate to:

http://Server_IP/

Replace Server_IP with your server's actual IP address or a domain pointing to your server.

You will be prompted to create an Administrator account.

Enter:

  • Admin Username
  • Admin Password

Under the Database section, enter:

Database User: nextclouduser

Database Password: StrongPassword

Database Name: nextcloud

Database Host: localhost

images

Click Install to complete the installation.

Once the installation is complete, log in using the administrator account you created.

You should now see the Nextcloud dashboard, where you can upload, synchronize, and securely share your files.

images

This concludes our guide on installing Nextcloud on Debian 13.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS