Running Owncloud on Raspberry PI

Placeholder image

Jan 9, 2021

OwnCloud file server initial page

OwnCloud is a file server that provides a convenient way to store files on Cloud, On-premises, or even in a Raspberry PI. OwnCloud is an open-source alternative to tools like Dropbox, Google Drive, or One Drive. Allowing not only store files but also contributing and sharing.

To start we need a Raspberry PI with Raspberry Pi OS (formerly Raspbian) installed, to store the files we can use the raspberry SD card or use an external hard drive.

Installing Apache and PHP

To properly run OwnCloud we need to setup a webserver with PHP support, including all required libraries. As a first step let’s update the system, then install the dependencies:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y apache2 php php-gd php-sqlite3 php-curl \
php-zip php-xml php-intl php-mbstring

Now apache2 is installed we need to enable the service to ensure it will start up in case of a reboot:

sudo systemctl enable apache2

Installing OwnCloud

We need to get the link for the latest version in the OwnCloud website, copy the link for the TAR file, and download it on your raspberry PI:

wget https://download.owncloud.org/community/owncloud-complete-20201216.tar.bz2
sudo tar -jxvf owncloud-complete-20201216.tar.bz2 -C /var/www/ && rm owncloud-complete-20201216.tar.bz2
sudo chown -R www-data:www-data /var/www/owncloud

We have now to configure apache to use the /var/www/owncloud directory, we can edit the default virtual host or create a new one, for simplicity let’s just replace the DocumentRoot on the default virtual server:

sudo sed -i s,/var/www/html,/var/www/owncloud,g /etc/apache2/sites-enabled/000-default.conf
sudo systemctl restart apache2

File Storage

Before starting the OwnCloud setup we need to prepare a directory to store the data. In this guide we are going to use the local raspberry SD card, however, you can set up now a directory using an external hard drive. Let’s create a data folder and give the necessary permissions:

sudo mkdir /data
sudo chown www-data:www-data /data

OwnCloud setup

The setup process is done accessing the server via browser, the first step is to define a username and password for the admin account and the data folder, click on ‘Storage & database’ and set the data folder to data

You will notice an alert regarding the SQLite usage, but as the Raspberry PI is not suitable for larger installations, the SQLite usage will not have a big impact on the performance.

After clicking in Finish Setup the setup process will start it and it takes a few minutes to complete, after completing you will be redirected to the login page.

After login will be able to start creating accounts and storing files.

There is a desktop application available for Windows, Mac, and Linux on OwnCloud Website and OwnCloud Mobile Apps for IOS or Android.

Tags