How to set up a Raspberry Pi ownCloud server

How to set up a Raspberry Pi ownCloud server

You don’t need us to tell you that cloud storage is a very useful thing. And, thanks to ownCloud, even those of us who don’t trust big companies with our data can enjoy the convenience of cloud storage. ownCloud is one of the best programs for running a cloud storage system on your Raspberry Pi, and with the help of it and DietPi, it’s easy for any Pi user to have their files at their fingertips anywhere they go. Sounds great, right? So how do you do it? We have you covered. Here’s how to set up a Raspberry Pi ownCloud server.

How to set up a Raspberry Pi ownCloud server

There are plenty of ways to get cloud storage. You can turn to services like DropBox or cloud services from major companies like Apple and Google. But you don’t necessarily have to pay money to get reliable cloud storage – and you don’t necessarily have to trust giant companies like Apple with all of your private files. You’re more than capable of replicating these services on your own. You’ll just need some storage (like an external hard drive) and a device. You’re reading The Pi, so you know where this is going: we’re going to use a Raspberry Pi. So grab your tools!

You’ll need all the usual stuff plus an Ethernet cable and an external storage device (optional, but recommended – if you’re going to set up ownCloud, you might as well give yourself plenty of storage space).

We’re going to install DietPi, a super-lightweight operating system for the Raspberry Pi. Then we’re going to use ownCloud that works on DietPi.

Step 1: Install DietPi on your Raspberry Pi

Your DietPi installation process is the same as with most other Raspberry Pi operating systems. Grab the disk image here, unzip it with the program of your choice (7-Zip will work), and then write the disk image to your microSD card with the program of your choice (Win32 Disk Imager on PC and Disk Utility on Mac will both work).

Step 2: Write down your IP address and log into DietPi

With DietPi on the microSD card and your Pi connected to the internet via Ethernet cable, go ahead and boot up. DietPi should print out your IP address even before you log in. We’re going to need that, so go ahead and write it down.

Log in with the username root and the password dietpi (you can do this on the Raspberry Pi itself or just SSH in from another computer). It’s your first time logging in, so DietPi will update automatically. Wait that out and then hit enter to reboot. Then log back in!

DietPi - First boot

Step 3: Install ownCloud

Once DietPi has rebooted and you’ve logged back in, you’ll be able to install new software – and that’s exactly what we’re going to do.

DietPi - Setup

The program we want is called ownCloud.

In the DietPi menus, navigate to Software Optimized – Select DietPI optimized sogtware for installation and then to 47 OwnCloud: your very own cloud (eg: dropbox). You’ll use the space bar to select and Enter to confirm.

DietPi - Setup (2)

After selecting ownCloud, you’ll be sent back to the menu you started from. Navigate to Install – Go >> Start installation for selected software and press Enter. On the following screen, select OK and hit Enter again to indicate that you’d like to begin.

DietPi - Setup (3)

DietPi will install ownCloud and then reboot (yes, DietPi really likes to reboot).

Step 4: Access the ownCloud web interface

Let the Pi reboot and then put it aside for a moment. Hop on another device and open a browser. Remember that IP address for your Raspberry Pi? The one you wrote down? Go ahead and type that in the address bar of your browser between http:// and /owncloud. For instance, mine looked like this: http://192.168.0.103/owncloud/.

What you’ve types here is the URL for your ownCloud web interface. And the first thing the web interface will do is run the setup wizard.

The setup wizard will prompt you to create an admin account. Choose your username and password, then take a look at the apps that ownCloud recommends you download. Take the program’s advice.

After all this, you’ll find yourself logged in to the ownCloud web interface.

ownCloud - Web interface

Step 5: Use your storage!

Your Raspberry Pi ownCloud server is now set up and you can start uploading files in the storage by clicking the plus symbol above the list of files and choosing Upload. You can hop into this interface with your browser on just about any device on your network, as well as through the ownCloud smart phone apps. You’ll need your username and password, of course, and you’ll have to make sure your Raspberry Pi is on when you need to access your cloud.

ownCloud - Web interface (2)

But wait – on your network? Your cloud storage is pretty limited if you can only use it in your own home. Let’s do just a couple more steps and make our cloud storage available anywhere.

Step 6: Set up port forwarding

If you want to access your ownCloud server from outside your home network (and you almost certainly do), you’ll need to set up port forwarding in your router’s admin interface and configure trusted domains in ownCloud’s settings.

Let’s take care of port forwarding first. Go ahead and access your router’s settings by typing your router’s IP address into a browser address bar. We’ll all have the same goals here, but our settings may look a little different. For instance, my router’s settings look like this:

Service Port: 80
Internal Port: 80
IP Address: [your Pi’s IP address]
Protocol: TCP
Common Service Port: HTTP

Change your settings so they match ours above (again, they won’t necessarily be in the same order or layout). Where we have [your Pi’s IP address], you should, of course, put your Pi’s actual IP address. This is the IP address you wrote down way back in Step 2.

That takes care of the router. Now for ownCloud.

Step 7: Configure trusted domains

With port forwarding set, ownCloud’s trusted domains setting is the last obstacle to enjoying cloud storage from outside your home network.

Hop on your Raspberry Pi and log into DietPi. Enter this command:

sudo nano /var/www/owncloud/config/config.php

We’re going to edit this config file and add your public IP address to the list of trusted domains. My config file looks like this:

<?php
$CONFIG = array (
'updatechecker' => false,
'instanceid' => 'oczs3u2vnel0',
'passwordsalt' => 'nRmHalWK8DQBNJ2bUicukJsg8Ys4Y2',
'secret' => 'fMP9Uix9Ub965r2ukRzKVgmn0ZK8GRSWWo5l1x9zseRZFkxS',
'trusted_domains' =>
 array (
 0 => '192.168.0.103',
 ),
'datadirectory' => '/var/www/owncloud/data',
'overwrite.cli.url' => 'http://192.168.0.103/owncloud',
'dbtype' => 'sqlite3',
'version' => '9.1.6.2',
'logtimezone' => 'UTC',
'installed' => true,
);

See that part I put in bold? You should have a similar section in yours, and that’s were you’re going to make our changes. Right above where the parentheses close, add a new line that reads 1=>'[your public IP address]’ – (where the part in brackets is, of course, your actual public IP address and not just those words). If you don’t know your public IP, you can just check by asking Google “what is my IP address?” Once you’ve got it right, the section will look like this:

'trusted_domains' =>
array (
0 => '192.168.0.103',
1 => '[your public IP address]'
),

Our new line is in bold in this example.

Now we’re all set. Exit the editor and save the config file by pressing Ctrl+X, then Y, then Enter.

Now you can log in to your ownCloud server from outside your home network by browsing to http://[your public IP address]/owncloud/. Note that we’re using the public IP address now instead of your Raspberry Pi’s IP address. That’s it – you now have cloud storage that works wherever you are!

27 Comments on "How to set up a Raspberry Pi ownCloud server"

  1. Thank you. Followed your steps and most of the way there. Did have to find another tutorial on adding an external drive though, but it wasn’t too tricky with DietPi. Might be an idea to add that information on here as not many would be using the SD card for storage right? Couple of things… a message came up… some issue with the .htaccess file – any idea how to fix this? Also, how would I go about setting up SSL with ownCloud? Thank you again for the tutorial. First time on your site. Very useful. Bookmarked!

  2. Michael, what tutorial did you use to add an external drive?

  3. If I am away from my home network, won’t my public IP address change depending upon which Wi-Fi hotspot I am using? Sorry I am not experienced in networking. Or is my public IP address always the same and tied to my hardware/MACADDR?

    • Your public IP may change if you’ve not been given a static (permanent) IP by your internet provider.

      No worries. Use a dynamic DNS service. DynDNS is the most common but it isn’t free. I use it because it works with my Linksys router. A free one to consider is NoIP.

      The Wi-Fi hotspot you use when away from home has zero impact on your home network or ownCloud. And you would only want to set up ownCloud at home (or an office).

  4. Followed all the steps and everything is installed, also everything starting up, but when I access 192.168.1.104/owncloud I get a 404.
    When I type 192.168.1.104 I get a screen with the message:
    Placeholder page
    The owner of this web site has not put up any web pages yet. Please come back later.

  5. Hi, I have this all set up on my Pi, however the first run wizard never appeared. I have reinstalled it three times and every time it just goes to a login page. Any tips?

  6. Eric, I just had the same problem. You will have to use the default password and username. If I Remember correctly its username: admin and password: admin. I was trying to find it on the web again and couldn’t. If that doesn’t work you’ll have to scour Google for the right ones.

  7. Hi, I am getting the same issue as Eric. Any tips?

  8. Eric, same for me – no setup wizard appears, just a login screen to input existing username and password.

  9. user = admin
    password = owncloud

    Worked for me.

  10. Hi guys, i encountered same problem of missing wizard page.

    Reading from the owncloud guide, I found the way to reset the admin password:
    sudo -u www-data php /var/www/owncloud/occ user:resetpassword admin

    After that, is possible to enter using Admin:NewPassword on owncloud.

  11. I am having the same login problem.

  12. Looks like the credentials are username = admin and password = dietpi

  13. What type of Pi did you use and what types are known to work? Pi is too generic, I can’t get it to run on a 1/B+ (v1.2/2014), so I am assuming you were using a Pi3 model B?

  14. Same happened to me.
    I followed https://doc.owncloud.org/server/9.0/admin_manual/configuration_user/reset_admin_password.html

    I.e.:
    Went to SSH (or CLI inside the Pi).
    I cd’ed to /var/www/owncloud, then issued command
    occ user:resetpassword admin
    and finally I was prompted for a new password/confirmation.
    Then returned to web interface and log in with the admin/NEWPASSWORD.

    Hope this helps.

  15. To solve the wizard problem:

    Delete the config.php in /var/www/owncloud/config –> go to IP/owncloud –> setup wizard appears.

  16. If the setup wizard doesn’t run, check this out:

    https://forum.owncloud.org/viewtopic.php?t=32640

  17. I am trying to add an external hard drive to the ownCloud. Do you have a tutorial for that?

Leave a comment

Your email address will not be published.


*