Install Nextcloud 17 on Debian 10

This tutorial will demonstrate how to install Nextcloud 17 on a Debian 10 server. Watch the video version here.

Prerequisites: You will need a server running Debian 10 (visit digitalocean.nots.co or linode.nots.co if you don't have one.) You will also need a domain name (visit hover.nots.co if you don't have one.)

Example parameters: In this example, the domain name for our Nextcloud server will be "example.nerdonthestreet.com". All passwords will be set to "P@ssw0rd".


Step 1: Make sure your server is entirely up-to-date:

Code

sudo apt update
sudo apt full-upgrade

Step 2: Install Apache, PHP, and MariaDB:

Code

apt install apache2 mariadb-server libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip

Step 3: Test your domain name to make sure Apache is installed properly.

Step 4: Install Certbot:

Code

apt install certbot python-certbot-apache

Step 5: Create a directory for the Nextcloud application files:

Code

mkdir /var/www/nextcloud

Step 6: Copy the default virtual host file and configure a virtual host for Nextcloud:

Code

cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/nextcloud.conf
nano /etc/apache2/sites-available/nextcloud.conf

Uncomment and set the following parameters:

Code

ServerName example.nerdonthestreet.com
ServerAdmin your@email.here
DocumentRoot /var/www/nextcloud

Step 7: Enable the virtual host and restart Apache:

Code

a2ensite nextcloud
systemctl reload apache2

Step 8: Run Certbot to enable SSL/TLS using Let's Encrypt:

Code

certbot --apache

Step 9: Copy the .tar.bz2 download link from the Nextcloud download page and download the archive to your server:

Code

wget https://paste.the/download-link.here

Step 10: Extract the Nextcloud application files from the archive, delete the archive, and move the Nextcloud application files into the current directory:

Code

tar xvf nextcloud-filename-here.tar.bz
rm nextcloud-filename-here.tar.bz
mv ./nextcloud/* .
mv ./nextcloud/.* .
rmdir nextcloud

Step 11: Make the web server the owner of the Nextcloud application files:

Code

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

Step 12: Create a Nextcloud data directory and make the web server the owner of that data directory:

Code

mkdir /ncdata
chown www-data:www-data /ncdata

Step 13: Secure your MariaDB server, enter MariaDB, create a database and user for Nextcloud, and give the MariaDB user permissions for the database:

Code

mysql_secure_installation
mariadb
CREATE DATABASE nextcloud;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL PRIVILEGES ON nextcloud . * TO 'nextcloud'@'localhost';
quit

Step 14: Fill in the details on the Nextcloud setup page and click the "Finish setup" button.

Step 15: Access the PHP configuration file for Apache:

Code

nano /etc/php/7.3/apache2/php.ini

Set the memory limit to 512 MB:

Code

memory_limit=512M

Step 16: Access the Apache virtual host configuration file:

Code

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

Add the HSTS header configuration and allow Nextcloud's .htaccess file to overwrite the default server settings:

Code

<IfModule mod_headers.c>
 Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
</IfModule>

<Directory /var/www/nextcloud/>
 AllowOverride All
</Directory>

Step 17: Enable the headers module, make sure the redirect module is enabled, and restart Apache:

Code

a2enmod headers
a2enmod rewrite
systemctl restart apache2

Step 18: Install APCu for memory caching:

Code

apt install php-apcu

Step 19: Configure Nextcloud to use APCu for memcaching:

Code

nano /var/www/nextcloud/config/config.php

Add this line:

Code

'memcache.local' => '\OC\Memcache\APCu',

Step 20: Restart Apache again:

Code

systemctl restart apache2

Your Nextcloud server should now be fully functional.


There are no pages beneath this page

Expand: Discussion Discussion (0 posts)