Personal cloud storage on the Orange Pi

Set up the personal cloud service

One cool and practical project you can do on an Orange Pi or a Raspberry Pi is to set up a free, personal and “on-premise” version of Dropbox. This will allow you, among other things, to share files between your different devices. Additionally, you can automatically upload any new pictures from your phone to the cloud storage. In this tutorial you will learn to install the private cloud server software, configure it and sync files from a mobile device. I tested these steps on the Orange Pi and I assume this will also work on the Raspberry Pi. We will store the data on and external device, like a USB flash drive or external HDD, connected to the Orange Pi.

The could server software we will use is Nextcloud. Nextcloud is very similar to Dropbox, the main difference being that Nextcould is open source and completely free. The next steps are loosely based on a Nextcloud installation guide for the Raspberry Pi. Also, I used the official Nextcloud documentation. Before installing Nexcloud, we need to install some dependencies. We will basically create a LAMP server. First update the package list:

sudo apt-get update

Then we need to install apache:

apt-get install apache2

To check the installation, type in the IP address of your Orange Pi in the browser of any device connected to your home network. You should see this page:

Next, install PHP and a database system. We have a few choices of databases: SQLite, MySQL and MariaDB. Here I will use MariaDB. You can also use MySQL. To install MySQL on the Orange Pi, please see this post. To install MariaDB:

sudo apt-get install mariadb-server

MariaDB will ask you to create a root password, which you will need further in the Nextcloud installation. Then, to install PHP:

sudo apt-get install php5 libapache2-mod-php5 -y
sudo apt-get install php5-gd
sudo apt-get install php5-mysql
sudo apt-get install php5-curl
sudo apt-get install php5-memcached

Next, let’s download and install Nextcloud:

sudo mv /var/www/html
cd /var/www/html
sudo unzip -q

In the following step, we will configure Nextcloud to that it stores data on an external device, such as a flash drive or hard disk. After connecting the external storage via USB, type in:

sudo fdisk -l

Based on the output, looking at the disk size and type, identify the external storage. On my Orange Pi it is called “sda1”:


Then, format this disk, mount it and give ownership to the HTTP user:

sudo mkfs -t ext4 /dev/sda1
sudo mkdir /disk
sudo mount /dev/sda1 /disk
sudo mkdir -p /disk/nextcloud/data
sudo chown www-data:www-data /disk/nextcloud/data
sudo chmod 750 /disk/nextcloud/data

Next, give ownership to the HTTP user on the Nextcloud directory:

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

Now type in the IP of your Orange PI, followed by “/nextcloud” (e.g. in the browser of any device on your home network. You should see the Nextcloud configuration screen:


Type in a username and password, that you will need later to connect from your phone. Expand “Storage & database”. Under “Data folder” put “/disk/nextcloud/data”. In the database section type in the root credentials and pick a database name of your choosing.

Synchronize files from the phone

To transfer files from the phone you need to install the Nextcloud client app from the App Store or Google Play, depending on your device. After installation, open the app and type in the server address as before (e.g. and your username and password:


Allow the app access to SD, if asked. Once logged in, you can either upload files manually or choose to auto-upload files to the cloud. To enable auto-upload touch the burger menu to the top left and select “Auto upload”:


Next touch the cloud symbol next corresponding to the camera folder:


That’s it, happy clouding!

Temperature sensor on Orange Pi with Python code
Face recognition on the Orange Pi with OpenCV and Python


  1. What version of opi did you use ? It’s opi zero h3 suitable for this install ?

    • Hi John, I have a Orange Pi Plus 2e which has an H3 CPU. I think it should also work on an OPI Zero.

  2. Hi,
    I followed the instruction, but after formatting disk, I got the problem as you see the below:

    root@orangepipc2:~# sudo chown www-data:www-data /disk/nextcloud/data
    chown: cannot access \’/disk/nextcloud/data\’: No such file or directory

    Please help me. I appreciate your help.

  3. Same problem here.

  4. I have the same problem with the :
    sudo chown -R www-data:www-data /var/www/nextcloud/

    it shoes me :
    chown: cannot access ‘/var/www/nextcloud/’: No such file or directory

    Please Help … :/

  5. Guys just run :

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

    and it will work, it was missing a file in the path the html inside it you can find Nextcloud. after this step you just login into nextcloud and your all set.

Leave a Reply

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