Install Nextcloud on Debian 10
Last updated on: 2020-07-24
Authored by: Rackspace Support
Nextcloud® is a file-sharing software similar to Google® Drive or Dropbox®. Because Nextcloud is open source, you have full control, and you can install the server on your machine. This article describes how to install Nextcloud on a Debian® 10 cloud server.
- A cloud server running Debian 10
- Access to the root or admin user
Install and configure a LAMP stack
Before you install Nextcloud, you must have a LAMP (Linux®, Apache®, MySQL® or MariaDB®, and PHP) stack on your server.
At the command line, enter the following commands to install Apache, MariaDB, and PHP:
apt install apache2 mariadb-server libapache2-mod-php7.3 unzip apt install php7.3-gd php7.3-json php7.3-mysql php7.3-curl php7.3-mbstring apt install php7.3-intl php-imagick php7.3-xml php7.3-zip
After you install MariaDB, you should run the following command to secure your database:
This command enables you to set a root password, disallow remote root logins, and delete the test database.
Configure your database by using the following steps:
Enter your MariaDB installation by using the following command:
Create a database for Nextcloud. Replace
with a database name of your choice. We recommend choosing a database name that clearly indicates the purpose of the database.
CREATE DATABASE <database>;
Create a user for the new database. Replace
with a username and with a secure password of your choice.
CREATE USER '<dbUser>'@'localhost' IDENTIFIED BY '<PASSWORD>';
user access to the database:
GRANT ALL PRIVILEGES ON <database>.* TO '<dbUser>'@'localhost';
Take note of these credential settings. You need them to access the database in Nextcloud.
Now that we have our base LAMP stack set up, we can move on to installing Nextcloud itself. Use the commands in the following steps to download and install Nextcloud:
Change to the document root directory.:
Download the latest version of Nextcloud:
Decompress the file:
Remove the compressed file:
Give ownership to the webserver:
chown -R www-data:www-data nextcloud/
systemctl restart apache2
In the web browser on your local machine, navigate to
Here, you can create the admin user and configure database access. For the admin account, choose any secure username and password combination. For the database, enter the same credentials that you configured earlier.
Nextcloud then installs the base system as well as a few applications you might find useful. After this finishes, the Nextcloud panel displays and you are ready to upload some files.