Raspberry Pi Owncloud Installation using Diet Pi image and WD Red 1TB Storage drives. Your cloud, your data, your way!

Equipment List

Raspberry Pi 3 ► Amazon | Ebay

Western Digital Red 1TB ► Amazon

Software List

Diet Pi ► http://www.dietpi.com/

Etcher ► https://etcher.io/

Raspberry Pi OwnCloud

Step 1: Install Diet Pi

Download the Image from https://www.dietpi.com/ -> Downloads

once your image has been downloaded, use etcher to copy the image to your sdcard

Step 2: Initial Configurations

On first boot you will need to login once with username root password dietpi then from here you will need to setup your internet. Once everything is connected to the internet and possibly rebooted once again, you will be able to select the software needed for this project.

Navigate over to Software Optimized and scroll down till you see “OwnCloud…” and select it using space bar.

you can now exit this screen back to the main screen to continue with the installation.

At this point it will take you about 30 minutes of pointless waiting so go grab a coffee.

Step 3: Formatting hard disk

Now it’s time to format and mount the disk at boot up time. This process may vary depending on how many hard drives you have connected. I currently have 1 hard drive connected so my device will be sda.

to start the process we need to type

$ fdisk /dev/sda

at this point we need to delete d and create a new partition with n then [enter] [enter] to leave default values. Once completed type w to write your changes

now we need to format the newly created partition

$ mkfs.ext4 /dev/sda1

to make the partition mount on boot we need to modify the fstab file

$ nano /etc/fstab/

goto the last line and add

$ /dev/sda1 /datastore ext4 defaults 0 0

save and close

now we have to create the datastore folder and fix the permissions

$ mkdir /datastore
$ chown www-data:www-data /datastore
$ chmod 0770 /datastore

finally! we can now reboot and double check if the hard drive gets mounted correctly!

Step 4: Setting up mysql

we now need to create a new database and user for owncloud in our mysql database

$ mysql -u root -pdietpi

to create a database

$ create database owncloud;

to create user for database

$ GRANT ALL PRIVILEGES ON owncloud.* TO 'oc_admin'@'localhost' IDENTIFIED BY 'password';

change password to the password you want to use

$ exit

Step 5: Finally! the web setup

Point your browser to your device IP address (ex: and add /owncloud at the end

this should start the setup process for admin user account for own cloud.

if this setup menu does not show you will need to delete a file in your config folder in owncloud by running this command

$rm /var/www/owncloud/config/config.php

now we just need to fill in the information, the username can be anything you want and this will be the administrative account for owncloud which allows you to add and remove users, next to set the data folder which we will need to change to “/datastore” so it will point to the hard drive we have mounted. as for the rest. simply put oc_admin for mysql username and the password you have given and long with database name of “owncloud”. now you can hit next and a new account will be created for you (takes 5 mins or so).


i would recommend watching the video, and or checking out the owncloud owners manual for list of features and functions.