Introduction
Nextcloud is a suite of file hosting software that began as a free, open-source, fork of ownCloud. It provides functions similar to Dropbox or Google Drive. This guide describes how to install Nextcloud on a newly-installed Debian server instance at Rcs.
Prerequisites
Update the system by following the best practices guide for Debian.
1. Install and Configure MariaDB
Install MariaDB.
# apt install mariadb-server php-mysql -y
Run the database security wizard.
# mysql_secure_installation
Answer the questions as follows. Replace the example password with a strong password.
Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: example-password
Re-enter new password: example-password
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
Sign in to MySQL with the password you chose.
# mysql -u root -p
Create a database for Nextcloud.
MariaDB> CREATE DATABASE nextclouddb;
Create a Nextcloud user and grant local access. Replace example-password with a stong password.
MariaDB> GRANT ALL ON nextclouddb.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY 'example-password';
MariaDB> FLUSH PRIVILEGES;
MariaDB> EXIT;
2. Install PHP
Install PHP and the necessary extensions.
# apt install php php-gd php-mbstring php-dom php-curl php-zip php-simplexml php-xml -y
3. Install Apache
Install Apache and the PHP module.
# apt install apache2 libapache2-mod-php -y
Start Apache and enable it to run at boot.
# systemctl start apache2
# systemctl enable apache2
4. Install Nextcloud
Locate the download URL for the most recent ***.tar.bz2** distribution of Nextcloud from this page. Download the *.tar.bz2 file with wget.
# wget https://download.nextcloud.com/server/releases/nextcloud-<VERSION_NUMBER>.tar.bz2
Unpack the distribution to the /var/www/html directory.
# tar -xjf nextcloud-18.0.4.tar.bz2 -C /var/www/html
Make Apache the owner of the Nextcloud files.
# chown -R www-data:www-data /var/www/html/nextcloud
# chmod -R 755 /var/www/html/nextcloud
5. Nextcloud Configuration
Navigate to the Nextcloud URL at your server's IP address.
http://192.0.2.123/nextcloud/
Enter the configuration information.
- Choose an admin username and secure password.
- Leave Data folder at the default value.
- For Database user, enter: nextcloud_user
- For Database password, enter the nextcloud_user password you chose in MariaDB.
- For Database name, enter: nextclouddb
- Leave "localhost" as "localhost".
Click Finish.
Conclusion
You have completed the basic Nextcloud setup on Debian 10. To install additional modules and themes, see the official documentation.