27.1 C
Texas
angeloma
Senior Writer and partner

How to install Nextcloud on Debian 9?

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…

- Advertisement -

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.

First, run:

:~$ su
:~# apt update && apt upgrade

1.- Upgrading the system
1.- Upgrading the system

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

2.- Install apache web server
2.- Install the Apache web server

Then, enable the Apache web server service to run at system startup.

:~# systemctl enable apache2

3.- Enabling apache web server service
3.- Enabling apache web server service

To check that everything is working correctly, open your web browser and go to http://IP_SERVER

4.- Apache2 web default page
4.- Apache2 web default page

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

5.- Installing PHP
5.- Installing PHP

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();
?>

6.- phpinfo()
6.- phpinfo()

Save the file and then close it. Go to the web browser and try to open it.

7.-PHP is correctly installed
7.-PHP is correctly installed

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

8.- Install MariaDB server
8.- 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

9.- MariaDB service status
9.- MariaDB service status

Then, you have to define a password to MariaDB and other settings. To do this, run mysql_secure_installation.

:~# mysql_secure_installation

After defining the password, answer the questions as you like, but I’ll do it that way: Y, N, Y, Y.

10.- Configuring MariaDB
10.- Configuring MariaDB

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;

11.- Creating some parameters for MariaDB
11.- Creating some parameters for MariaDB

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

12.- Install Nextcloud
12.- Install Nextcloud

Now unzip it in /var/www/html.

:~# unzip nextcloud-14.0.2.zip -d /var/www/html/

13.- Unziping Nextcloud
13.- Unzipping Nextcloud

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/

14.- Changing the permission to the nexcloud folder
14.- Changing the permission to the nextcloud folder

6. Access from the web browser

Now you can access from the web browser, http://IP_SERVER/nextcloud and you will see this.

15.- Nextcloud configuration parameters
15.- Nextcloud configuration parameters

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.

16.- Nextcloud is alive
16.- Nextcloud is alive

Now you can enjoy your private cloud.

Conclusion

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.

 

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

2 COMMENTS

  1. “You need to restart apache after installing the php stuff.”

    This is correct and you also need to set a password for the MariaDB “nextclouduser” with root privileges, so do the following:

    CREATE DATABASE nextcloud;
    USE nextcloud;
    GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextclouduser’@’localhost’ IDENTIFIED BY ‘userpss’;
    SET PASSWORD FOR ‘nextclouduser’@’localhost’ = PASSWORD(‘yourpassword’);
    FLUSH PRIVILEGES;
    exit;

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article