Nextcloud installation on Raspberry Pi for all models

Published by Harish Kumar on

In this segment we are going to show you how to “Install Nextcloud installation on Raspberry Pi for all models”

What is NextCloud ?

Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud application functionally is similar to Dropbox. Unlike Dropbox, Nextcloud does not offer off-premises file storage hosting. Nextcloud is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices.

In contrast to proprietary services like Dropbox, the open architecture allows adding functionality to the server in the form of applications and enables users to have full control of their data.

The original ownCloud developer Frank Karlitschek forked ownCloud and created Nextcloud, which continues to be actively developed by Karlitschek and other members of the original ownCloud team.

Source /> Wikipedia


   Nextcloud Equipment Required :

Equipment Raspberry Pi all models

Equipment Micro SD Card 8 GB

Equipment Power Supply

Equipment Ethernet Cord for LAN Connection

raspberrypi External Hard Drive or USB Drive

    Nextcloud Optional :

Case Raspberry Pi Case

Keyboard Keyboard

Mouse Mouse

Software Required :

Raspbian OS Installation

  • Download Raspbian OS from Official Website :
  • Then write the image to the SD Card using : Etcher
  • Now, Boot the Raspberry Pi with this SD Card, Follow the On-Screen Instructions and then open Terminal.

Enabling SSH in Raspbian OS

  • By default SSH is disabled in Raspbian. So, we need to enable it from desktop.
  • Launch Raspberry Pi Configuration.

Menu –> Preferences –> Raspberry Pi Configuration

  • Navigate to the Interfaces tab
  • Select Enabled next to SSH
  • Click OK.


Enabling SSH in Raspbian OS through Terminal

  • Enter sudo raspi-config in a terminal window
sudo raspi-config
  • Select Interfacing Options


  • Navigate to and select SSH


  • Choose Yes–> Ok –> Finish

Enabling SSH in Raspbian OS through Commands

sudo systemctl enable ssh 
sudo systemctl start ssh

 Apache and PHP Installation

Updating and Upgrading Raspbian OS

apt-get update 
apt-get upgrade

Installing Apache Web Server

apt-get install apache2
  • To check the status of Apache Web server, type Raspberry Pi Ip Address in the address bar.


  • If we see this screen that mean the Apache Web Server is working Fine.

Installing Mariadb DataBase

apt-get install apache2 mariadb-server libapache2-mod-php7.0

Installing PHP Packages

apt-get install php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring 
apt-get install php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip
  • After that installation will complete setup. We will restart the Apache Web Server.

Restarting Apache Web Server

service apache2 restart

NextCloud Installation

Navigate to HTML Directory

cd /var/www/html

Downloading and Extracting NextCloud using Curl command

curl | sudo tar -jxv
  • Please, Change the Nextcloud version from its official website.

Creating Data Directory for NextCloud to save the Information

sudo mkdir -p /var/www/html/nextcloud/data

Providing Control of NextCloud folder to Correct User and Group.

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

Providing right permissions to NextCloud DATA folder.

sudo chmod 750 /var/www/html/nextcloud/data
  • Now the process of NextCloud installation is finished. Now, we can finally move to NextCloud login process.
  • To begin go to your Raspberry Pi’s IP address/nextcloud. For example, In my case:
  • Once you type the correct address you will be redirected to NextCloud Login Screen.


  • Here you can type your username and password that you want to use as a Admin Account.
  • If you want to use the NextCloud from outside your network, we recommend you to choose a strong password.
  • Once you are happy with your settings, press the “Finish Setup” button, to finalize the setup process.
  • It might take some time to finish the setup. So, please wait and don’t refresh the page.

Access NextCloud from Internet

  • To access the NextCloud from Internet, we need to complete 3 steps. 
Port Forwarding
Setup Dynamic DNS [In case you don't have a Static Public IP Address]
Add website to Trusted Domains

Setting up Port Forwarding on Router

  • To forward the port on the router, we need to know the IP Address of our router.
  • To check the router IP Address we can use the Wireless Network Watcher.
  • It will display the router IP Address as shown below.


  • Type this IP Address to your browser and it will open the login page for your router.
  • Now, you need to enter the username & password and login to your router.
  • If you don’t know the username & password of your router you can always ask your ISP.
  • For personal routers you can always check online for default username & password for the router.
  • In my case i need to navigate to services and then move to Port Forwarding, Your’s might be different.
  • Then you need to forward Port 80 and 443, to the Raspberry Pi IP Address.Nextcloud

Setting up Dynamic DNS

  • First of all we need to visit DUCKDNS website to create a Free Dynamic DNS Domain for us.


  • You can use any of the above method to login to DUCKDNS website and create a sub-domain for your website.
  • Once you logged in then create a sub-domain for your NextCloud and can visit NextCloud by that address.


  • For example in my case i have created omvpcmac as my subdomain.
  • So, i can access it as
  • You can create 5 subdomains on Duck DNS account for free.

Add website to Trusted Domains

  • To add our website to Trusted Domain’s we need to edit NextCloud Configuration file.
  • We can either use WinSCP and we can use nano command to edit the file.
Edit NextCloud’s Configuration File
sudo nano /var/www/html/nextcloud/config/config.php
  • Now, in Configuration file, we need to add our website to the Trusted Domains.
'trusted_domains' => 
array (
0 => '',
  • In my case, I have added my sub-domain to NextCloud Trusted Domain.
  • So, we need to make another entry by increment the array ID.
'trusted_domains' => 
array (
0 => '',
1 => '',
  • Now we can save and quit out of the file by pressing Ctrl+X then pressing Y and then Enter.
  • If you follow the video and the tutorial correctly, your NextCloud should work now.

Add External HDD to NextCloud

  • Connect the External HDD to Raspberry Pi
  • From the NextCloud Menu select Apps and then enable External Storage Support.
  • After that we need to open Putty, login with root user and type these commands.
sudo chown -R www-data:www-data /path/to/localdir 
sudo chmod -R 0750 /path/to/localdir
  • You can find the path to Local Drive from File System options in OpenMediaVault.


  • Now, you can go ahead and mount your External HDD in NextCloud.
  • You need to navigate to Settings–> Administration–> External Storage and configure the path of HDD.


In conclusion,you are ready to use Nextcloud on your Raspberry Pi.

If you come across any issues or have some feedback related to this tutorial,

Please share your thoughts. Smile (“_”)

Please checkout my other articles:

Android TV on Raspberry Pi Model BOpenMediaVault 5 on Raspberry Pi

Chromium OS on Raspberry Pi-4OpenMediaVault 5 on Raspberry Pi

Did you Like my Work ?

Please Like, Share and Subscribe our YouTube Channel.

Harish Kumar

As a founder of the PcMac YouTube channel and website, Our goal is to provide Free Technical help to people and spread knowledge to everyone.


OpenWRT Setup on Raspberry Pi | PcMac RaspberryPi · December 23, 2019 at 6:47 am

[…] Nextcloud installation on Raspberry Pi All Models […]

RetroPie Installation & Configuration Complete Setup - PcMac · February 7, 2020 at 2:44 pm

[…] Nextcloud installation on Raspberry Pi for all models […]

Leave a Reply

Your email address will not be published. Required fields are marked *