We recently talked about Nextcloud. A great tool to create personal clouds. Today, I will show you how to install Nextcloud on Debian 9.
Nextcloud is an OpenSource application, which allows you to install a private cloud on any server. Many companies that do not wish to entrust their data to third parties, use this tool to access their files over the Internet.
The three aspects that highlight Nextcloud and in turn are powerful reasons to use it are:
- Control: You will not entrust your files and data to a third party. In addition, you will be the one who configures the entire service.
- Productivity: Being your own who manages the data, you will reduce access times and thanks to extensions you can increase the power of Nextcloud.
- Community: Nextcloud is quite popular so you won’t feel alone in using it, on the contrary, you will have a lot of support and documentation.
In short, you can visit their website or Github site for more useful information. Let’s start.
0. Before start…
It is easy to install Nextcloud on Debian 9 but you should be aware of the following:
- The Linux terminal is a powerful weapon and it is advisable to have some knowledge about its use.
- Commands must be executed as root. Remember that you are going to install and configure packages.
- The Debian machine must allow access from ssh. It is very simple this guide can be useful to you.
- The purpose of this tutorial is to install Nextcloud 14 on Debian 9 Stretch.
No more talking, let’s get started.
1.- Upgrade the system
if I’m talking about security and information control, then the first logical step to install Nextcloud in Debian is to update all installed packages. This ensures that the latest security patches are available. Simply put, you will have a more secure system.
:~$ su :~# apt update && apt upgrade
With this done you can continue.
2. Install Apache web server
Nextcloud is a web application built to be deployed on a web server. In other words, you have to install a basic web infrastructure in order to run it. The first step is to install apache web server. Run:
:~# apt install apache2
Then, enable the Apache web server service to run at system startup.
:~# systemctl enable apache2
To check that everything is working correctly, open your web browser and go to
Apache web server is installed and configured correctly.
3.- Install PHP
As I said before, PHP is the language that nextcloud can interpret. So, you have to install it.
:~# apt install php7.0 libapache2-mod-php7.0 php7.0-common php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php7.0-imagick php7.0-xml php7.0-zip
To see if PHP is correctly installed. Create a file in
/var/www/html/ with the following content:
:~# nano /var/www/html/test.php
<?php phpinfo(); ?>
Save the file and then close it. Go to the web browser and try to open it.
If you see the image above, then PHP is correctly installed.
4. Install MariaDB
The next step to install Nextcloud on Debian 9 is to install MariaDB. Nextcloud requires a database manager and MariaDB is free and very good.
:~# apt install mariadb-server
At the end of the installation, enable the service to start with the system.
:~# systemctl enable mariadb
Then, check the status of the service.
:~# systemctl status mariadb
Then, you have to define a password to MariaDB and other settings. To do this, run
After defining the password, answer the questions as you like, but I’ll do it that way: Y, N, Y, Y.
Now you must create a database for Nextcloud. After that, create a user for that database and reload MariaDB’s privileges. First, access to MariaDB console.
:~# mysql -u root -p
Once you have logged in to the MariaDB console, so, you can start creating the database and the rest of the operations.
CREATE DATABASE nextcloud; USE nextcloud; GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'userpss'; FLUSH PRIVILEGES; exit;
Now, you can install Nextcloud.
5. Install Nextcloud on Debian 9
The moment of truth has arrived, the moment to install Nextcloud has arrived. So, you have to download it.
:~# cd /opt/ :~# wget https://download.nextcloud.com/server/releases/nextcloud-14.0.2.zip
Now unzip it in /var/www/html.
:~# unzip nextcloud-14.0.2.zip -d /var/www/html/
Then change the owner of the Nextcloud folder and assign corresponding permissions.
:~# chown -R www-data:www-data /var/www/html/nextcloud/ :~# chmod -R 755 /var/www/html/nextcloud/
6. Access from the web browser
Now you can access from the web browser, http://IP_SERVER/nextcloud and you will see this.
On this screen you must enter the information corresponding to MariaDB. In user admin and in password the one you want. When you have done it, click on the Finish setup button.
And if everything went right, you’ll see Nextcloud working.
Now you can enjoy your private cloud.
Nextcloud is a good alternative if you want to independent your files or those of your company from giants like Microsoft or Google. Or if you want to have control of your data.
We want to know about you, have you used Nextcloud? has this article served you? how about your experience with Nextcloud?
Please share this article through your social networks.