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:

sudo apt update
sudo apt full-upgrade

Step 2: Install Apache, PHP, and MariaDB:

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:

apt install certbot python-certbot-apache

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

mkdir /var/www/nextcloud

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

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:

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

Step 7: Enable the virtual host and restart Apache:

a2ensite nextcloud
systemctl reload apache2

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

certbot --apache

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

cd /var/www/nextcloud
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:

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:

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:

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:

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:

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

Set the memory limit to 512 MB:

memory_limit=512M

Step 16: Access the Apache virtual host configuration file:

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:

<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:

a2enmod headers
a2enmod rewrite
systemctl restart apache2

Step 18: Install APCu for memory caching:

apt install php-apcu

Step 19: Configure Nextcloud to use APCu for memcaching:

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

Add this line:

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

Step 20: Restart Apache again:

systemctl restart apache2

Your Nextcloud server should now be fully functional.


There are no pages beneath this page

Expand: Discussion Discussion (0 posts)