How to Make a Raspberry Pi Cloud Server

by drjhxie in Circuits > Raspberry Pi

30239 Views, 21 Favorites, 0 Comments

How to Make a Raspberry Pi Cloud Server

image.png

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.

Supplies

IMG_5187.jpg
  1. Raspberry Pi of any kind (Faster is better)
  2. Micro SD card (For the Raspberry Pi)
  3. Computer (Other than the Raspberry Pi)

Install DietPi on Your Raspberry Pi

Screen Shot 2022-02-15 at 6.44.57 PM.png

The DietPi installation process is pretty much the same as with most other Raspberry Pi operating systems. 

Get the disk image here, unzip it with the program of your choice (7-Zip will work), and then write the disk image to your micro SD card with the program of your choice (Win32 Disk Imager on PC and Disk Utility on Mac will both work.)

(You can also use the Raspberry Pi Imager. To do that, open the Imager and select "Use Custom")

Write Down Your IP Address and Log Into DietPi

image.png

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!

Install OwnCloud

image.png
image.png
image.png

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.

The program we want is called ownCloud.

In the DietPi menus, navigate to Software Optimized – Select DietPI optimized software 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.

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 will install ownCloud and then reboot (Yes, DietPi really likes to reboot).

Access the OwnCloud Web Interface

image.png

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 typed 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.

Use Your Storage!

image.png

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 smartphone 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.

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.

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 your 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.

Configure Trusted Domains

With the 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!