How To Install Nextcloud on Debian 10

Install Nextcloud on Debian 10

In this tutorial, we will show you how to install Nextcloud on Debian 10. For those of you who didn’t know, Nextcloud is a free and open-source cloud file sharing application (Calendar, Contacts, Documents, Email, and more). The developers at Nextcloud are doing their best to give the users a more secure platform, fewer bugs, and overall a better product. Nextcloud not only has all the features of ownCloud but also plans to provide new and innovative ones.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation of Nextcloud free and open-source cloud file sharing application on a Debian 10 (Buster).

Install Nextcloud on Debian 10 Buster

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade

Step 2. Installing the LAMP stack.

A Debian 10 LAMP server is required. If you do not have LAMP installed, Please read our previous tutorial to install LAMP Server on Debian 10.

Step 3. Installing Nextcloud on Debian 10.

Now we download NextCloud packages from the official website of NextCloud with the following command:

wget https://download.nextcloud.com/server/releases/nextcloud-20.0.7.zip

Extract the Nextcloud packages to the document root directory on your server:

sudo unzip nextcloud-20.0.7.zip -d /var/www/html/

We will need to change some folders permissions:

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

Step 4. Configuring MariaDB for Nextcloud.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. You should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB.

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, we will need to log in to the MariaDB console and create a database for the Joomla. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Nextcloud installation:

MariaDB [(none)]> CREATE DATABASE nextcloud_db;
MariaDB [(none)]> GRANT ALL ON nextcloud_db.* TO ‘nextcloud_user’@’localhost’ IDENTIFIED BY ‘Your-Strong-Password’;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Step 5. Create Apache web server for Nextcloud.

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘nextcloud.conf’ on your virtual server:

nano /etc/apache2/sites-available/nextcloud.conf

Add the following lines:

<VirtualHost *:80>
        DocumentRoot "/var/www/html/nextcloud"
        ServerName nextcloud.griyaku.lan
        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
           </IfModule>
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
        Satisfy Any
       </Directory>
</VirtualHost>

Now, we can restart the Apache webserver so that the changes take place:

sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf
sudo sudo a2enmod rewrite
sudo a2ensite nextcloud.conf
sudo systemctl restart apache2.service

Step 6. Accessing Nextcloud on Debian.

Nextcloud will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.com/ or http://server-ip and complete the required steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

Install Nextcloud on Debian 10 Buster

Congratulations! You have successfully installed Nextcloud. Thanks for using this tutorial for installing Nextcloud free and open-source cloud file sharing application on Debian 10 Buster system. For additional help or useful information, we recommend you check the official Nextcloud website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!