support Click to see our new support page.
support For sales enquiry!

Installation of NextCloud on Server

next cloud

Sarin RajJune 16, 2019

Nextcloud is an open source private or self hosted file share and collaboration platform, similar to Dropbox. It functionally similar to Dropbox, Unlike Dropbox Nextcloud does not offer off-premises file storage hosing. As we told that It is open-source so anyone can install and operate it on their own private server device. The owncloud developer Frank Karlitschek forked owncloud and create Nextcloud, they continues to be actively developed by karlitscheck and other member of the original owncloud team.This blog explains about the Installation of NextCloud on Server.

The files are stored in a conventional directory structure that accessible from any web browsers or interface without any additional software. Synchronise nextcloud with local systems of windows , macOS or linux distributions, also support Ios and Android devices, Also it offers features like Media player, Calender, Contact Management.

Nextcloud provide users and group administration, And the users can create public URLs when sharing files. The Nextcloud which more focused on direct user to user communication and cooperation features.

More Features of NEXTCLOUD

Nextcloud has new features such as Monitoring Capabilities, Full text search and Kerberos Authentication, Audio/Video conferencing, Expanded federation and Smaller user interface improvements.All of the official components of Nextcloud are free we pay only for support and update services.

We can add plugins to it to improve functionality, Some addons functionalities

  • Calendar
  • Contact
  • Streaming Media
  • Gallery
  • Bookmarking Service
  • URL shortening

Nextcloud offers higher security features, it refuse continuous attempts to authenticate from any computer except the ip address included in brute-force ip white-lists.

It provide content security policy and security assertion markup language.

For Small number of users NextCloud installed on lightweight hardware like Raspberry Pi, About up to 150 users NextCloud recommend a server with 2 CPU cores and 16 GB of RAM for to run all of the services required. For the best compatibility of Nextcloud 13 in shared hosting account to server using nginx instead of Apache or as an Ubuntu snap package.

Installation of Next cloud server on Ubuntu 18.04 with Apache2 , Maria DB And PHP 7.2 Support

STEP 1 : Install apache2 server on Ubuntu

Next-cloud needs Apache2 HTTP server on Ubuntu by installing apache2 by following steps

sudo apt update

sudo apt installing apache2 

Then stop, start and enable the apache 2 server

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

STEP 2 : Installing maria db database server

MariaDB database server is a open source database server to install MariaDB run the command below,

sudo apt-get install mariadb-server mariadb-client

Then stop, start and enable the mariadb service

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Follow the below command for the secure mariadb server by creating a root password and disallowing remote root access.

sudo mysql_secure_installaion

just answer the following questions like

Enter current password for root (enter for none): Just press the Enter

Set root password? [Y/n]: Y

New password: Enter password

Re-enter new password: Repeat 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

Then restart mariadb server

STEP 3 : Install PHP 7.2 and related modules

Run the command below to add third party repository

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php 

After the installation upgrade the PHP 7.2

sudo apt update

Installing PHP related modules by following the command below

sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip

Then make changes on the PHP default value of the file like

sudo nano /etc/php/7.2/apache2/php.ini

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

STEP 4 : Restart the apache2

To reload PHP configurations Restart the Apache2 server

sudo systemctl restart apache2.service

create a phpinfo.php file for test PHP7.2 settings in apache2 root directory

sudo vim /var/www/html/phpinfo.php

and type

  <!?php phpinfo();?>  

we can see the PHP default test page


PHP default test page

STEP 5 : Create nextcloud database

Here we configuring the server, to logon to mariadb database server

sudo mysql -u root -p

Then create a database nextcloud


Then creating a database user nextcloud user with a new password

CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';

After grant the user full access to the database

GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Then save the changes



STEP 6 : Download latest next-cloud file

To get latest release we want to use Github repository , install composer, curl and other dependencies to get stated

sudo apt install curl git

curl -sS | sudo php -- --install-dir=/usr/local/bin --filename=composer

After the installation of curl and composer, change into the apache2 root directory and download next cloud packages from github

cd /var/www/html

sudo git clone --branch stable13 nextcloud

cd /var/www/html/nextcloud

sudo composer install

sudo git submodule update --init

Then set the correct permission for the next-cloud function

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

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

STEP 7 : Configure apache2

This file will control how users access NextCloud content

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

Copy the content below into the file and save

     DocumentRoot /var/www/html/nextcloud/
     Alias /nextcloud "/var/www/html/nextcloud/"

        Options +FollowSymlinks
        AllowOverride All
        Require all granted
            Dav off
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

STEP 8 : Enable the nextcloud and rewrite module

After creating the virtual host then enable it by using below commands

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

STEP 9 : Restart the apache2

To load all the setings above, to restart the apache2

sudo systemctl restart apache2.service

Then open the browser and type

Fill the details and login in to nextcloud

login in to nextcloud


LinkedIn LinkedIn