This guide will provide us with a very simple way to have a personal cloud with Raspberry Pi. We’ll use a Raspberry Pi 3 Model B+, with an external USB drive that will store all our data. Our USB disk will be formatted in this procedure in order to assure that it will work. So be aware to use a free USB disk in order to avoid loss of data at format time.
From the software side, we’ll use Docker to have the enhancements obtained from the container and NextCloud.
What We Need
As usual, I suggest adding from now to your favourite e-commerce shopping cart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continue with the project or remove them from the shopping cart. So, hardware will be only:
- Raspberry PI (including proper power supply or using a smartphone micro usb charger with at least 3A)
- high speed micro SD card (at least 16 GB, at least class 10)
Check hardware prices with the following links:
Step By Step Guide
Prepare OS environment
Our private cloud will be installed on the official lite operating system. Use install Raspberry PI OS Lite guide to accomplish this task. Once done, remember to update from the terminal:
sudo apt update -y && sudo apt upgrade -y
Prepare USB Storage
Please note that your USB Storage must be formatted with ext4 FS. You can achieve it with the following command, assuming that your Storage is recognized as “/dev/sda”:
sudo umount /dev/sda && sudo mkfs.ext4 /dev/sda
You have to get assured that your USB storage will be available on every boot at the same mount point. This isn’t granted with Raspberry PI OS Lite (differently from RPI OS Desktop).
Let’s assume that this mount point will be “/media/myUSB/”, you can get it working after every reboot by using my Automount USB storage with Raspberry PI OS Lite: fstab and autofs tutorial.
Please note that the ext4 file system doesn’t allow setting uid and gid in your mount options, as it automatically manages permissions. For this reason, both for fstab and autofs you have to use the following mount options:
Install Nextcloud Container
It’s time to use Docker. As usual, it allows us to install and prepare the container with 1 row (copy and paste the entire following command):
docker run -d -p 8080:80 --name nextcloud --restart unless-stopped \ -v /media/myUSB/nextcloud:/var/www/html \ -v /media/myUSB/apps:/var/www/html/custom_apps \ -v /media/myUSB/config:/var/www/html/config \ -v /media/myUSB/data:/var/www/html/data \ -v /media/myUSB/theme:/var/www/html/themes \ nextcloud
this simple command will map all main volumes on your USB key and initialize Nextcloud container. Be patient, because slow USB disks will require a while to prepare the container. You will be able to monitor the installation process by typing:
docker logs nextcloud
or simple monitoring increasing USB disk space used from Nextcloud (on /media/usb0):
watch df -H
at the end of the process, it should have been used about 500MB of space.
Login NextCloud and Last Settings
Once the initialization has been completed, open with your browser the address http://<<YOUR_RPI_IP_ADDRESS>>:8080. You will see the following homepage (in your language, depending on your browser settings):
NextCloud already brings with the docker container a SQLlite database, but if you want to use an external one, you can set it by clicking the “Storage & Database link”:
Fill in the username and password that you want to create for your admin account and click on “Install”.
After a while to complete more settings, the screen will show you a suggestion to install the recommended apps:
You can choose to install them or simply to use the “Cancel” link to go on our installation and install them in a following moment. The next screen will show you the main features of NexCloud. You can scroll them with the side arrows:
Finally, we get to NextCloud dashboard:
As you can see, you already have a number of files preloaded that you can test.
Form the admin user, with the menu on the top-left side of the screen you can add apps and users to add your NextCloud installation with more features and/or more users.
Interested in more projects for your RPI computer board? Take a look at peppe8o Raspberry PI tutorials!
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?