Nextcloud is a free, open-source self-hosted file synchronization and sharing application that allows users to securely access and share their data from anywhere. In this article, we will explain how to install and configure Nextcloud on a system running the Debian 10 operating system.
Before we begin, there are a few prerequisites that need to be met. First, you must have a system running Debian 10, and it should be connected to the internet. You will also need to have administrative privileges on the system, as the installation process requires access to the root user account or a user account with sudo privileges.
To start, let’s update the package manager index and upgrade any existing packages to their latest versions. This is important because it ensures that we have the latest security patches and bug fixes, as well as the latest versions of the packages we will be installing. Run the following command to update the package manager index:
sudo apt update
Next, run the following command to upgrade any existing packages to their latest versions:
sudo apt upgrade
Once the package manager index has been updated and any existing packages have been upgraded, we can proceed with the installation of Nextcloud. To do this, we will use the apt package manager.
First, run the following command to install the Apache web server, which Nextcloud will be running on:
sudo apt install apache2
Next, we will need to install the PHP programming language and the required PHP modules for Nextcloud. Run the following command to do this:
sudo apt install php7.3 libapache2-mod-php7.3 php7.3-common php7.3-curl php7.3-gd php7.3-json php7.3-mbstring php7.3-mysql php7.3-zip
Now that the Apache web server and PHP are installed, we can download and install the Nextcloud package. To do this, run the following commands:
wget <https://download.nextcloud.com/server/releases/latest-18.tar.bz2>
tar xjf latest-18.tar.bz2
sudo mv nextcloud /var/www/html/nextcloud
These commands will download the latest version of Nextcloud, extract the contents of the package, and move the extracted files to the appropriate directory in the Apache web server’s document root.
Next, we need to set the correct permissions on the Nextcloud directory. Run the following commands to do this:
sudo chown -R www-data:www-data /var/www/html/nextcloud/
sudo chmod -R 755 /var/www/html/nextcloud/
These commands will ensure that the Apache web server has the correct permissions to access and modify the Nextcloud files.
Now that the Nextcloud files are in place, we can proceed with the configuration of the Apache web server. To do this, we will need to create a new Apache configuration file for Nextcloud. Run the following command to create the file:
sudo nano /etc/apache2/sites-available/nextcloud.conf
This will open the file in the nano text editor. From here, you can paste the following configuration settings into the file, which will configure the Apache web server to serve Nextcloud:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/nextcloud
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>
</VirtualHost>
Be sure to replace “example.com” with your own domain name, and “admin@example.com” with your own email address.
Once you have finished editing the Nextcloud Apache configuration file, save your changes and exit the text editor. Then, run the following commands to enable the Nextcloud Apache configuration and disable the default Apache configuration:
sudo a2ensite nextcloud
sudo a2dissite 000-default
Next, we need to enable the Apache modules required by Nextcloud. Run the following commands to do this:
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime
Finally, restart the Apache web server to apply the changes:
sudo systemctl restart apache2
Now that the Apache web server is configured to serve Nextcloud, you can access the Nextcloud installation wizard by visiting your domain name in a web browser. For example, if your domain name is “example.com“, you would visit “http://example.com
” in your web browser.
The Nextcloud installation wizard will guide you through the process of setting up your Nextcloud instance. This includes creating a new administrator account, setting the database connection details, and configuring any additional options.
Once the Nextcloud installation is complete, you can log in to your Nextcloud instance using the administrator account you created. From here, you can start using Nextcloud to store and share your files securely.
That’s it! You have successfully installed and configured Nextcloud on your system running Debian 10. You can now use Nextcloud to securely access and share your files from anywhere.