Tech

Set up your own cloud with Raspberry Pi and ownCloud


If you do not want to transfer your personal data to third-party servers, you can also store them on a home server, for example a Raspberry Pi. And in connection with the ownCloud software, this results in a cheap solution for hosting.

When private users go to the cloud, they primarily use the services of the major providers for their data storage. Advantages include the ease of use, the targeted sharing of various content and the now good integration into the desktop and other applications. The most important aspect is probably data security. But the available storage space and the associated costs also play a role for the user.

For some time now, those who want more control and convenience such as their own user administration and various additional modules have been able to fall back on solutions for hosting on their own server. Solutions like ownCloud are enjoying growing popularity. It also runs on the Raspberry Pi, which is cheap for everyone who already has one in operation as a small home server.

It is still possible to make your storage space available on the web and not just in the local network. Then the Pi needs a static IP and the necessary care around secure access to the sometimes very private data.

ownCloud photos

At home we have had a Raspberry Pi with various server software and good experience in 24-hour operation for a long time. At this point we want to make the jump to the beginning and illustrate how to set up a Pi as a cloud server with ownCloud.

Prepare Pi

How to put a Raspberry Pi into operation, there are now extensive instructions on the web. That’s why I don’t want to go into too much detail for the basic steps.

We have a Raspberry Pi 3B +, which is already running and probably represents a good compromise between power consumption and performance. The current Pi version 4 is of course just as suitable. Older models offer less performance, which should be considered for server operation.

If you start from scratch, you first need an image with Pi-OS, which you can get from the official download page and which you have to put on the SD card for the Pi.

The easiest way to continue with the big Pis is to connect a cable to the router, keyboard and monitor, boot into the graphical X desktop, update there and make all the essential settings. A desktop is not absolutely necessary, without a GUI you can change with

the standard password and also the user ID. We allow access via

ssh

. From now on you can also work remotely in the terminal. And we set the host name with which you can later reach the Pi in the local network. Means

will be updated first.

An HTTP server, PHP and sqlite are now required to operate the cloud. If you want to work with Lighttpd as a resource-saving HTTP server, you can install it using

$ sudo apt install lighttpd

Of course, Apache also works as usual, for the installation you replace the package name with “apache2” at this point. For the installation of PHP and sqlite you can sometimes find older instructions on the web where PHP5 should be used.

The 5 version is now out of date and is no longer an installation candidate. You should at least use PHP version 7.3. Sqlite can optionally also be specified as “sqlite3”:

$ sudo apt install php7.3 php7.3-gd sqlite3 php7.3-sqlite3 php7.3-curl

Not to forget the specific PHP modules that ownCloud still needs:

$ sudo apt install php7.3-zip php7.3-dom php7.3-intl php7.3-mb

With Lighttpd, the central configuration settings are located under “/etc/lighttpd/lighttpd.conf”. Here you can also find the entry “server.document-root”, under newer Raspian versions or Pi-OS the directory “/ var / www / html” is set by default:

# server.document-root  = "/var/www/html"
server.document-root    = "/mnt/disk/www/html"
server.upload-dirs      = ( "/var/cache/lighttpd/uploads" )
 server.errorlog         = "/var/log/lighttpd/error.log"
 server.pid-file         = "/var/run/lighttpd.pid"
 server.username         = "www-data"
server.groupname        = "www-data"
 server.port             = 80

In order to create enough space for all content, we now enter a new path to an external disk or SSD on the Pi, which we previously stored in a permanent location in the file system, for example under

/ mnt / disk

have hung. How this can best be done, there are various instructions on the web and should therefore not be part of our description here.

The following is an example of the document root of our HTTP server

/ mnt / disk / www / html

apply, on which you now store the files for the ownCloud. If you want, you can now make further settings in the configuration file. Then the web server should use

$ sudo service lighttpd restart

restarted. If you want to make sure that PHP is processed properly and that the new document root is recognized, you can use the well-known content there

create a minimal file with any name, e.g. phptest.php, after calling it in the web browser under

the PHP parameters in the window should be read like this or similar:

PHP test page

As always, “Hostname” stands for the IP address or the name of the Pi, which it received in your network configuration beforehand.

Install ownCloud

At the moment there is ownCloud version 10.5 on the

NewsABC.net page of the project.
It is easier to get the sources using

$ wget https://download.owncloud.org/community/owncloud-10.5.0.zip

Under

https://download.owncloud.org/community/
you can check the current version in the browser and, as an alternative to the zip file, get the tarball. After downloading approx. 44 MB, everything in the document directory must be extracted:

$ sudo mv owncloud-10.5.0.zip /mnt/disk/www/html
$ sudo unzip -q owncloud-10.5.0.zip

Then you get a folder

owncloud

, in which a data directory (here

data

) should be created and given the appropriate rights:

$ sudo mkdir /mnt/disk/www/html/owncloud/data
$ sudo chown www-data:www-data /mnt/disk/www/html/owncloud/data
$ sudo chmod 750 /mnt/disk/www/html/owncloud/data

Then it’s best to reboot the Pi:

Now you can take a deep breath, because all the preparatory work has been done.

Put the cloud into operation

In addition to other content on the server, we are now in the subfolder with the cloud

owncloud

resident and can thus target this by specifying the following as a URL the first time it is called up in the browser:

This should bring you to the ownCloud login screen. However, it is possible that instead you will be shown which PHP modules you have not yet installed for proper operation.

Missing modules

But the server is already running, not bad. In the event of an error, it is important to reinstall and refresh the Pi by restarting or rebooting.

If that worked, you will be asked to create an admin account. The performance warning for sqlite can be ignored if the cloud is used moderately. Once you have entered your desired access data, you go to the first login and you see the start view of ownCloud.

ownCloud login

Done! For us as administrators, it is worth taking a look at the folder structure. ownCloud has under the directory

data

Now another subdirectory is created according to the username, which is further down

cache

,

thumbnails

and

files

branched. Under files there are again

Documents

and

Photos

.

Access from the web

Making OwnCloud available for access from the web no longer has to do directly with the actual software and installation. A few tips on top of that, because once you have your own cloud up and running, you may miss access while on the move.

Our home server is entered as an HTTPS server in the router’s shares on port 443. In order to be able to reach the home network from outside, you also need a static IP under which you can access your router in a defined manner. There are also DynDNS services, nowadays in a rather manageable number, if you are looking for a stable and free service as a private user.

Most of the router’s user interfaces offer a selection option for known DynDNS services or manual entries can be made. If you have previously registered with a service, you enter the domain name, username and password. This dialog is available for Fritzbox users:

Fritzbox - DynDNS settings

If you don’t value a fancy domain name, it works especially for users of the Fritzbox but also without an external service, where we turn the remote access options of the box for our purposes. Myfritz is used here and you first need a user account there. You can create it with the same credentials as for the box so that you don’t have to remember any further access data.

Then switch to

Internet | Myfritz account

the account you just configured and under

Internet | Approvals | Fritzbox services

general access for remote maintenance:

Settings Fritzbox remote access

Enlarge

Settings Fritzbox remote access

© Swen Hopfe

The complete URL and port number can now also be read here. But since we do not want to use the Fritz interface for remote maintenance, we simply leave out the port number when calling it in the browser. A typical call, with your own letter / number combination at the beginning, looks like this:

https://a2b4c6d8e0f2g4h6i8k0.myfritz.net

After entering the access data for the previously configured Fritz user, you can now access the document directory of your server at home, from which you can start ownCloud again.

Summarized

One advantage of ownCloud is that the basic settings on the web interface are easy to find and that they are not too numerous and are clearly arranged. So it doesn’t take a long training. Installation and setup will be easy for any reasonably experienced Raspi user.

It is also good that there is a “market” where you can add additional modules such as picture gallery, PDF viewer or other security functions to your standard installation.

In the local network, your own cloud is still faster than the external “clouds” on a high-speed connection, where the upload speed is not least important. With the Raspberry Pi, you create storage space by not working on the SD card, but by placing the home directory of the cloud on an external storage medium. As always, you are primarily responsible for the appropriate backup and the necessary security, especially when accessing the web.

I am quite satisfied with this solution, which we have been using for a long time for domestic LAN purposes and can recommend installing it on the Pi as a server for the ownCloud.

Tags

Related Articles

Back to top button
Close
Close