With our devices becoming more and more connected to the world and with the increasing number of files to keep stored and accessible from outside the home, cloud services have provided space to store data for free, but with limited space and with increasing questions about security and privacy. OwnCloud and Raspberry PI can give you a new and cheap solution to assure privacy for your data and get a cloud with a huge space for your files.
In this tutorial, I’m going to show you how to install OwnCloud in Raspberry PI with Docker.
What is OwnCloud
OwnCloud is a collaboration tool enabling you to store and share your files like many common cloud services (such as Google Drive, Microsoft One Drive and so on). It has a community edition enabling you to install it on several server devices at home, one of them being the Raspberry PI computer boards.
OwnCloud also includes client apps to connect your server at home from Desktop computers, Android and Apple smartphones.
The base installation makes already you enabled to share files with your family and friends, but OwnCloud has a modular architecture that allows you to install addons with a single click and add more features to your private cloud. For example, the Activity Stream addon lets you keep track of work progress, also showing who did what with which file or folder.
Using OwnCloud from the Internet
Please note that if you want to use OwnCloud from outside the home, you will need from your Internet Service Provider a public IP. Moreover, you will probably need a mnemonic domain, so that you will reach your server without the need to remember every time your IP. For this, a great and free solution is using the free No-IP with the Raspberry PI that will run OwnCloud. Finally, you will need to have control of your router so forwarding the traffic on 8080 port coming from outside to your RPI.
For this tutorial, I’m going to use a Raspberry PI 3 Model A+, but this guide will be usable also with all the newer Raspberry PI computer boards.
What We Need
As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if continue with the project or remove them from the shopping cart. So, hardware will be only:
- Raspberry PI 3 Model A+ (including proper power supply or using a smartphone micro usb charger with at least 3A) or newer Raspberry PI Board
- high speed micro SD card (at least 16 GB, at least class 10)
Check hardware prices with the following links:
Prepare the Operating System
Start installing the OS in your Raspberry PI. For this tutorial, I’m going to use the 64-bit OS.
I suggest (especially for those Raspberry PI models with less RAM) installing Raspberry PI OS Lite to get a fast OS. You can also use Raspberry PI OS Desktop, in this case working from its internal terminal command.
Make your OS up to date. From the terminal, use the following command:
sudo apt update -y && sudo apt upgrade -y
For this installation, I’m going to use the official docker container from OwnCloud, to get a simpler installation way and avoiding to install all prerequisites as are already all available in their container.
For this reason, we need to install Docker on Raspberry PI.
With docker installed, OnwCloud is ready in your Raspberry PI only with the following command line:
docker run -d -p 8080:8080 --name owncloud --restart unless-stopped -v owncloud_data:/mnt/data owncloud/server
Please find below the explanation of used options:
- “-d”: this option makes the container run as a daemon in your Raspberry PI, so being detached from the terminal (this means that if you close the terminal, your container will continue running
- “-p 8080:8080”: this option maps the ports used. The number on the left side is the host port (the port you will use to open OwnCloud from an external device) and can be set to whatever port you prefer, while the number on the right side is the container port and cannot be changed as it depends on container internal configuration (where the container exposes its services)
- “–name owncloud”: this option gives a mnemonic name to the container. If set, you can send commands to docker by referring to this name instead of the container ID or the random name. For example, with this set, you can see the OwnCloud logs by issuing the command “docker logs owncloud”
- “–restart unless-stopped”: this option set the container to restart automatically unless you force the container to stop. This set is useful to manage, for example, Raspberry PI reboots without having to start again the container manually
- “-v owncloud_data:/mnt/data”: this option makes the OwnCloud data persistent in your Raspberry PI storage. With this set, you will be able to backup OwnCloud data by keeping a copy of owncloud_data folder available in “/var/lib/docker/volumes/” path (please note that you can access this path only as root
- “owncloud/server”: this is the container name that will be downloaded from Docker Hub and used in your installation
After issuing the command above, your Raspberry PI will start downloading the docker image and unpackaging it. Once done, you will be able to check that the container is running by using the following command:
docker ps -a
Your OwnCloud container should show an “Up” in the status column.
For here, you can connect from an external device to your OwnCloud server by using a common browser, with the URL composed by your Raspberry PI’s IP Address and the port set on the docker run command. As my RPI has internal IP “192.168.1.177”, it will be for me “http://192.168.1.177:8080”.
The OwnCloud login page will appear (if not, please wait a few minutes as container startup could take a few minutes in smaller RPIs):
The OwnCloud default admin user (to enter for the very first run) will be the following:
- Username: admin
- Password: admin
With this user, you can administrate the OwnCloud server and create new users. At the first login, you will get a popup inviting you to use OwnCloud apps on the other devices you own to get files synced. You can close this popup with the “X” on top-right:
This installation will keep you also a few files to start testing OwnCloud. These files also include the OwnCloud Manual:
Create a User
To create a new user, with the Admin user go to the admin drop-down menu and select “Users”:
Here you will find the list of all the users enabled in your OwnCloud installation (only the admin in a fresh installation):
Fill in the username and email fields on top. The drop-down menu on the right side of these fields will allow you to assign the new user to a specified group. You can also create a new group on the fly by using the “add group” button. Then click the “Create” button:
A new user will be created and listed. From the Admin user you can also edit the user’s password, (for example to give the new user a password that he’ll change at its login) by moving the mouse on the user row and clicking the pencil icon appearing as in the following picture:
At this point, you can give the username, password and OwnCloud URL to your user for logging in.
Installing Apps from Market
You can add more features to your OwnCloud installation by installing add-ons. The easiest way is by accessing the built-in market place available from the hamburger menu on top-left part of admin page:
Here you can browse the available addons and get more details by selecting one from its heading link. You can also filter addons by using the categories menu on the left sidebar:
Let’s try, for example, installing the calendar addon. Filter the productivity category and identify the calendar addon:
By clicking the calendar title, you will see a details page. Scrolling down you will be able to identify the “install” button. Click it to install:
A confirmation message will appear once the addon is installed:
You can access this addon from the hamburger menu on top-right and selecting Calendar:
The full doc is available from the official OwnCloud server manual page.
Interested in more projects with your RPI? Take a look at peppe8o Raspberry PI computers tutorials pages.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?