How to install Nextcloud on Debian10

Nextcloud is a software package for file hosting. It provides some features similar to Dropbox or Google Drive.

Install and configure MariaDB

Install MariaDB

# apt install mariadb-server php-mysql -y

Run Database Security Wizard

# mysql_secure_installation

Answer the necessary questions as shown below. Next, replace the root password with more complex characters

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

Log in to MySQL with the password selected

# mysql -u root -p

Create a database for Nextcloud

MariaDB> CREATE DATABASE nextclouddb;

Create a Nextcloud user and provide local access. Replace the password that is represented (example-password) with a strong password

MariaDB> GRANT ALL ON nextclouddb.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY 'example-password';
MariaDB> FLUSH PRIVILEGES;
MariaDB> EXIT;

Install PHP

# apt install php php-gd php-mbstring php-dom php-curl php-zip php-simplexml php-xml -y

Install Apache

# apt install apache2 libapache2-mod-php -y

Launch Apache and enable it every time you boot

# systemctl start apache2
# systemctl enable apache2

Install Nextcloud

You need to do this as follows: find on this page the URL to download the latest * .tar.bz2 Nextcloud distribution. Download the * .tar.bz2 file using wget. This guide uses version 18.0.4 as an example

# wget https://download.nextcloud.com/server/releases/nextcloud-18.0.4.tar.bz2

Unzip the distribution into the directory /var/www/html

# tar -xjf nextcloud-18.0.4.tar.bz2 -C /var/www/html

Make Apache the owner of Nextcloud files.

# chown -R www-data:www-data /var/www/html/nextcloud
# chmod -R 755 /var/www/html/nextcloud

Nextcloud Configuration

Go to the Nextcloud URL at the IP address of your server

http://192.0.2.123/nextcloud/

Then enter the following 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.

Was this article helpful?

Related Articles

Leave A Comment?