24.9 C
Senior Writer and partner

How to install Nextcloud in Ubuntu 18.04?

While it is true that there are many services dedicated to data storage, it is also true that many individuals and small businesses prefer to be in control of the way they are managed. Nextcloud is a great free, open source alternative that makes it easy to deploy a private cloud.

Nextcloud emerges as an Owncloud fork. It is free of charge and focuses on security, flexibility and accessibility. From their project website, they tell us that they follow industry best practices regarding security; they continually implement new patches to the application as well as the use of extensive security protocols so that the stored data cannot be violated by third parties.

Productivity is another of the highlights of Nextcloud: you can direct the workflow and make processes more efficient in the organization.

As an open source application, it has a great community spirit that allows it to improve every day.

Installing on ubuntu

1.-Upgrading the system

- Advertisement -

It is always advisable to update the system, remember that with this, we will have the latest security updates available. Therefore, open a terminal and write:

               sudo apt update && sudo apt -y upgrade

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

Once the process is complete, we will have our system updated.

2.-Installing a LAMP server

Nextcloud runs within a web environment, and is a PHP application, so we must install and configure a LAMP server to install and run the application.

To install apache as a web server:

          sudo apt install apache2

2.- Installing apache
2.- Installing apache

Then we must install php and some extra modules for the application to run.

             sudo apt install libapache2-mod-php7.2 php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-intl php-imagick php7.2-xml php7.2-zip

3.- Installing php
3.- Installing php

Some of these modules are vital, such as the one that allows the execution of php with apache, the one that integrates php with mariaDB, among others.

To test the installation of apache and php, we opened a new file:

            sudo nano /var/www/html/test.php

We write the following:




4.- phpinfo function
4.- phpinfo function

And if you access the URL localhost/t.php  from your web browser and see the following, it means that everything is fine.

5.- phpinfo
5.- phpinfo

Now we must create an apache configuration file. We write:

             sudo nano /etc/apache2/sites-available/nextcloud.conf

And in the file we added the following:

Alias /nextcloud “/var/www/html/nextcloud/”

<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All

<IfModule mod_dav.c>
Dav off

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud


12.-Apache configuration
6.-Apache configuration

We save the file and leave.

Now we enable the apache modules:

8.- Modules apache
7.- Modules apache

Then create a symlink to /etc/apache2/sites-enabled:

             sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf

Now it’s MariaDB’s turn:

            sudo apt install mariadb-server mariadb-client

6.- installing mariadb
8.- installing mariadb

With this we already have a LAMP server running on our Ubuntu 18.04.

3.- Preparing MariaDB

First we must run the mysql_secure_installation scritp to configure some MariaDB options. For example, changing your password, and some other things. We answer Y,N,Y,Y,Y,Y.

            sudo mysql_secure_installation

7.- mysql_secure_installation
9.- mysql_secure_installation

8.- mysql_secure_installation
10.- mysql_secure_installation

After the configuration process has been completed, we have to create the database dedicated to nextcloud, the user and the necessary write permissions. We entered the mariadb console:

             sudo mysql -u root -p

and then we create the user:

             create user ‘nextclouduser’@’localhost’ identified by ‘nextcloudpss’;

Where nextclouduser refers to the user and nextcloudpss is the password. Trade it for whatever you want.

Now we create the database:

             create database nextclouddb;

And we assign the new user permissions based on the nextcloud database we just created.

10.- database configuration
11.- database configuration

Now we refresh all permissions and exit the MariaDB console.

  flush privileges;


11.- Database and user configuration
12.- Database and user configuration

4.- Downloading Nextcloud

Now we proceed to download nextcloud:

              wget https://download.nextcloud.com/server/releases/nextcloud-13.0.4.zip

12.- Downloading nextcloud
13.- Downloading the file

Then we proceed to decompress it:


13.- Unziping nextcloud .zip file
14.- Unziping .zip file

Now, we move it to the apache directory:

             sudo mv nextcloud /var/www/html/nextcloud

14.- Moving the folder
15.- Moving the folder

We changed the owner of the folder in the apache directory.

             sudo chown www-data:www-data /var/www/html/nextcloud/ -R

And the permissions:

            sudo chmod 755 -R /var/www/html/nextcloud/

15.- Changing permissions to folder
16.- Changing permissions to folder

and finally, we restart the Apache service:

           sudo systemctl restart apache2

5.-Accessing Nextcloud from your web browser

At this point, we should already be able to access the Nextcloud panel from the web browser:


18.- Nextcloud
17.- Nextcloud

On this page we must create the administrator user. If we scroll down, we will also find that we must enter the parameters of MariaDB:


17.- Configuring Nextcloud
17.- Configuring Nextcloud

And finally, after the installation is finished, we’ll see the main panel.

19.- Installation completed!
18.- Installation completed!

We have completed the installation of Nextcloud, a leading application in its field that has more and more business support and users who like to have their files in the cloud under their control.

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


Please enter your comment!
Please enter your name here

Latest article