Cloud storage is incredibly useful for accessing your data from any device. The downside is that you have to trust a corporation with the privacy and security of your precious documents and photos stored on remote servers.
There is an alternative, though: you can host your files on your very own cloud server running on a computer in your home or office. One of the most popular services for achieving this is ownCloud.
We’ll show you how to install ownCloud on a Raspberry Pi, attach external storage, and choose a suitable case.
ownCloud vs Nextcloud for Raspberry Pi: Which Is Best?
Another option for your home-based Raspberry Pi cloud server is Nextcloud, an independent spin-off of ownCloud created by some of the latter’s core contributors.
While the core features are very similar for both services, there are some key differences. Some of the more advanced features in ownCloud are only available for premium subscribers, whereas all features are free in Nextcloud.
Even so, ownCloud is a good, well-established option and is completely free to use if you’re self-hosting your server(s). Features include end-to-end encryption, two-factor authentication, antivirus, firewall, and file integrity checking.
1. Prepare Your Raspberry Pi
Unlike Nextcloud, which offers a custom OS image for Raspberry Pi in the form of NextCloudPi that you write to a microSD card, as well as an Ubuntu Appliance option ownCloud is installed within an existing iteration of the standard version of Raspberry Pi OS.
If you are yet to install Raspberry Pi OS, write it to a microSD card (8GB or higher is advisable) on another computer using the Raspberry Pi Imager tool.
Once that’s done, insert the microSD card in your Raspberry Pi and power it up. Go through the welcome wizard, selecting a new password (for security reasons) and connecting to your Wi-Fi network.
Before installing ownCloud, you should make sure Raspberry Pi OS is fully up to date. If you haven’t already done so during the welcome wizard, open up a Terminal window (Accessories > Terminal) and enter the following commands:
sudo apt-get updatesudo apt-get upgrade
It may take a few minutes. With the Raspberry Pi to your wireless router, discover its IP address by entering:
Note down the inet address under wlan0: this is the Raspberry Pi’s IP address. Some routers will reserve the same address for the Raspberry Pi each time it’s booted; if not, you’ll want to set up a static IP address for your Raspberry Pi.
2. Install Apache 2, PHP 5, and SQLite
Before installing ownCloud itself, you’ll need to add essential components of the server stack. To install the Apache HTTP Server, in the Terminal enter:
sudo apt-get install apache2
Once this has finished installing, you should check it’s working. Open a web browser on another computer and enter your Raspberry Pi’s IP address. You should get a default Apache web page saying ‘It works!’
You are now ready to install the PHP web scripting language, SQLite database management system, and other required packages with this Terminal command:
sudo apt-get install php7.3 php7.3-gd sqlite php7.3-sqlite php7.3-curl php7.3-zip php3-dom php7.3-intl
Once they’re all successfully installed, restart the Apache web server with the following command:
sudo service apache2 restart
3. Install ownCloud
You are now ready to install ownCloud itself. Download the latest stable ZIP file from the official ownCloud downloads page to your Raspberry Pi. We downloaded owncloud-complete-20210326.zip.
In a Terminal window, move the downloaded file to the /var/www/html directory with:
cd Downloadssudo mv owncloud-complete-20210326.zip /var/www/html
Change to that directory and unzip the file:
cd /var/www/htmlsudo unzip -q owncloud-complete-20210326.zip
Next, you need to create a data directory for ownCloud and alter its permissions. If you’re just using the microSD for your server’s storage, enter the following commands:
sudo mkdir /var/www/html/owncloud/datasudo chown www-data:www-data /var/www/html/owncloud/datasudo chmod 750 /var/www/html/owncloud/data
If using an external USB drive for storage, attach and mount it on your Raspberry Pi, then enter the following commands instead:
sudo mkdir /media/ownclouddrivesudo chown www-data:www-data /media/ownclouddrivesudo chmod 750 /media/ownclouddrive
Note: If you want to move the data to a different directory at a later date, see the ownCloud guide to how to move a data directory.
Next, input the following commands to give writing permissions to avoid some potential login errors later on:
sudo chmod 777 /var/www/html/owncloudsudo mkdir /var/lib/php/sessionsudo chmod 777 /var/lib/php/session
Once that’s all done, it’s time to reboot your Raspberry Pi for the changes to take effect:
4. Configure ownCloud
From a web browser, visit the Raspberry Pi’s IP address following by /owncloud, e.g. 192.168.1.132/owncloud.
If you see a warning that your connection isn’t private or secure, choose to ignore it (by selecting Advanced in Chrome or Firefox) and proceed to the site.
The ownCloud login screen should appear. If you see a performance warning about SQLite, you can safely ignore it.
You now need to register an admin account by entering a username and password. Make sure to note them down. With this, your personal ownCloud is now available using this account.
Log in and start exploring the web dashboard for your self-hosted ownCloud server. To begin with, you can browse a couple of folders for documents and photos.
To add extra functionality, click the menu at the top left and select Market. You can browse the available apps and install any you want, such as a Calendar and the Collabora office suite.
5. Add External Access Over the Internet
So far, you can only access your ownCloud server from your own local network, which is a bit limiting. To access your ownCloud server over the internet from any location requires you to set up SSL, enable port forwarding, and use a dynamic DNS service.
6. Choose a Case For Your ownCloud Server
Running your ownCloud server on a bare Raspberry Pi board isn’t recommended as it will accumulate dust over time. There’s a wide variety of cases available for standard-size Raspberry Pi 3 and 4 models.
Rather than a cheap plastic case, we’d recommend something more solid such as the DeskPi Pro. This has enough room inside the case for a SATA storage drive and is supplied with an M.2 to SATA adapter. To prevent your Raspberry Pi overheating, it also features an ICE Tower cooling system and heatsink.
Another very good option is the Argon ONE M.2 case, which enables you to use any size M.2 SATA drive. Alternatively, you could choose a robust case for Raspberry Pi on its own and plug in a standard external USB storage drive.
Build Your Own Raspberry Pi Cloud Server: Success
Congratulations, you have now set up a cloud server on your Raspberry Pi using ownCloud. You can visit its dashboard using a web browser on another device. There’s even an ownCloud app for iOS and Android that you can use to access the server from a smartphone or tablet.