Installation of Pi-Cloud on Raspberry Pi 5

What will we need?

A Raspberry Pi 5 with OMV pre-installed - see tutorial Pi-NAS.

OMV will be installed on an SSD due to higher performance! Without an SD card. Anyway, the process is the same as for an SD card.

 

Software

After installing and configuring Open Media Vault according to the tutorial, we need to make a few changes. The first is to change the default Open Media Vault port, as Casa OS also uses port 80.

We’ll do this by connecting via SSH and entering the following command:

sudo omv-firstaid

PiCloud - Změna portu OMV

In the Configure workbench section, change the port from 80 to 81.

PiCloud - OMV firstaaid change port

Confirm and reboot.

sudo reboot

 

      1) Installing Casa OS

After connecting, update the OS using these two commands:

sudo apt-get update

sudo apt-get upgrade

It will take a few minutes. Finally, install Casa OS by copying the following script:

wget -qO- https://get.casaos.io | sudo bash

After a few minutes, the Casa OS application is ready for use. Open your web browser and enter the IP address of your Raspberry Pi, e.g., http://192.168.1.56. Create an admin account for Casa OS. OMV will be on port 81, i.e., http://192.168.1.56:81

Casa OS - První přihlášení

What is CasaOS?

An open-source operating system designed for use on home servers and NAS (Network Attached Storage) devices. It enables easy installation and management of containerized applications using Docker, simplifying the deployment of various services like media servers, VPNs, or data synchronization applications. It supports the installation of various applications and extensions, allowing customization to user needs. 

 2) Installing MariaDB

After logging into Casa OS, select Apps and search for MariaDB. Click on it (do not click Install) and choose Custom install from the dropdown arrow next to Install.

 

Casa OS - MariaDB

Fill in the following details. Essentially, select only the MariaDB network and change the database name and login details. Use your own password!

PiCloud - CasaOS - mariadb

 

Click on Install. After a moment, it's done.

4) Installing Nextcloud

Go to Apps and search for Nextcloud. Click on it (do not click Install) and choose Custom install from the dropdown arrow next to Install.

 Casa OS - NextCloud

 

Fill in the following details. Simply select only the MariaDB network.

PiCloud - NextCloud installation

After installation, go to Nextcloud. Simply enter the same IP with a different port. As seen in the image above, the port is 10081. In our case, we enter http://192.168.1.56:10081 and set up the first user. Below, enter the database user and database name. The hostname is mariadb. This is crucial!

 

PiCloud - NextCloud First Login Database

And that's it! Nextcloud is functional. However, Nextcloud data is currently on a single SSD along with the system. If you only have one SSD and want to keep it that way, you can. However, if something happens to the disk and you don’t have a backup, you risk losing your data. We have a guide to improve this by moving Nextcloud data to a separate SSD and adding another SSD for mirroring/backup using Open Media Vault.

 

PiCloud - schéma záloh a disků

We connect to Open Media Vault (e.g.: http://192.168.1.56:81) and set up the SSD drives. If you don’t have them set up, create ext4 partitions for the second and third disks with tags diskA and diskB. See instructions in the tutorial Pi-NAS. Also, set up backup from diskA to diskB. It should look something like this:

PiCloud - OMV disks

 PiCloud - Shared folders

PiCloud - Rsync

 

Log into Casa OS (e.g., http://192.168.1.56) and open the Terminal (Linux command line) using the third icon from the left at the top.

Nextcloud saves data to the folder /DATA/AppData/nextcloud/var/www/html/data by default. Open Media Vault mapped the disks for us in Shared Folders. We need to manually link the disks to folders /DATA/AppData/nextcloud/var/www/html/diskA and /DATA/AppData/nextcloud/var/www/html/diskB and change the Nextcloud configuration to work with these folders.

1) Navigate to the folder /DATA/AppData/nextcloud/var/www/html/ by typing the command in the Terminal

cd /DATA/AppData/nextcloud/var/www/html/

Nextcloud data folder

2) Create the folders diskA and diskB

mkdir diskA

mkdir diskB

Nextcloud Custom Data Folder

3) Edit /etc/fstab and add automatic mapping to the folders in the Nextcloud root

sudo nano /etc/fstab

and add two lines at the end of the file (replace according to your UUIDs). See example below:

PiCloud - fstab mount

we added these. Copy /srv/dev-* according to your UUIDs above:

# This was added manually
/srv/dev-disk-by-uuid-de29ff0b-9530-479d-95a3-20777880dd7e /DATA/AppData/nextcloud/var/www/html/diskA none bind 0 0
/srv/dev-disk-by-uuid-4e8605ff-1148-4f89-9743-d02df1ffd14a /DATA/AppData/nextcloud/var/www/html/diskB none bind 0 0

 

Save by pressing CTRL+O, confirm with Enter, and exit the nano editor with CTRL+X.

Restart the Raspberry Pi.

4) Finally, the most complex task:

a) Copy the contents of the /data folder to the /diskA folder

switch to root by typing:

sudo -s

navigate to the /data folder (cd /data) and copy the contents with:

cp -r * ../diskA

 

One hidden file is still missing. Copy it manually

cp .ocdata ../diskA

 

PiCloud - NextCloud - ocdata

Finally, set permissions for the user www-data for the folder diskA and all subfolders and files with the command:

chown -R www-data:www-data diskA

5) Now we will change the Nextcloud configuration:

Open the terminal again in Casa OS, navigate to the folder /DATA/AppData/nextcloud/var/www/html/config  and edit the file config.php

sudo nano config.php

PiCloud - change Nextcloud default directory

Change the default data folder to diskA

PiCloud - change Nextcloud default directory

6) Restart Nextcloud, for example via the icon in Casa OS:

 

 Nextcloud should now start and use folders on a separate SSD disk. According to the rsync settings, these folders should also be backed up to diskB. You can verify this in Casa OS under Files

PiCloud - Disk A

 

PiCloud - Disk B

 If anything happens to diskA, simply change the Nextcloud configuration to diskB, and you're good to go!

Tip: For security reasons, we recommend using the 3-2-1 backup strategy. This means keeping one external backup copy manually, for example, on external HDD. Perform this backup once every six months or more often as needed. The 3-2-1 strategy means you have 3 copies of your data, two backups, and one backup offsite (outside the building) to protect against fire, theft or advanced ransomwares.

Add comment

Nejlepší články z blogu

Tailscale - remote access without public IP
Tailscale - remote access without public IPRating: 
90%

The Tailscale service solves access between individual devices if you don't have a public IP address. It's free for one user with support for up to 100 devices. We'll show you how to install Tailscale on a Raspberry Pi that you'll have at home and on a client (Android, iPhone) from which you'll want to access the home Raspberry Pi. Our example will be remote access to OpenHAB running on a Raspberry Pi. However, the same setup applies to many other applications - home NAS, PiHole, Home Assistant, Domoticz, NextCloud, and others.

Shelly OpenHAB MQTT
Shelly vs OpenHABRating: 
90%

The Shelly brand is known for its products that primarily communicate over WiFi, including smart plugs, relay switches, blinds control relays, and many other devices. One of the advantages for deployment is the ability to both read and control these devices using the universal MQTT protocol. Across existing add-ons for both OpenHAB and Home Assistant, we will demonstrate how to use Shelly devices without installing any additional extensions.

Victron & OpenHAB
Victron vs Smart HomeRating: 
0%

In this post, we will show you how to retrieve information from a photovoltaic power plant by Victron. We will connect to the Cerbo unit via MQTT. Based on these values, we can control various appliances (heating, boiler, etc.) and prevent the battery from being drained when they don't need to be.

Smart Home GoodWe inverter
Smart Home vs GoodWeRating: 
50%

In the post, we will demonstrate step by step how to communicate directly with the GoodWe inverter in a smart home setup and obtain real-time information (unlike the SEMS portal). This information is essential if we want to react to current parameters in a smart home, such as activating additional cooling or controlling a socket with a various load.

Voice control smart home
Voice control of the houseRating: 
60%

In this article, we will connect the Amazon Echo Dot voice assistant with open source home automation. We won't be using OpenHAB Cloud, so everything runs locally. In this case, a few additional settings are necessary, but the result is worth it!

MikroTik - Winbox, DHCP, Ranges
Basics - Winbox, DHCPRating: 
68.8%

In this series, we will look at the step-by-step setup of MikroTik devices for home users or a small business (up to 25 people). In the first article, we will focus on the initial setup - we will download Winbox and set up DHCP for the primary network and guest network. Similarly, we will also adjust the WiFi settings.

Alarm Smart Home PIR
Alarm from existing PIR sensors in a smart home.Rating: 
0%

In a your smart home, PIR sensors may not only be used to switch lights on and off based on motion, it is possible to utilize these sensors to detect the presence of motion in a particular room. This information can be used to create a relatively reliable uncertified home security system. In this guide, you will find the logic for how this can work in the OpenHAB software in our model smart home.

NFC Tag Example in Smart Home
NFC tags in smart homeRating: 
80%

NFC (Near Field Communication) tags are small plastic or paper stickers that can be used to automate various functions in the smart home. In this article, we will show you examples of use and a guide on how to write an action on an NFC tag using a mobile phone.

WireGuard iOS
WireGuard on iOS devicesRating: 
88%

In this article, you will find a detailed guide on how to connect to WireGuard VPN from iOS.

WireGuard on Android device
WireGuard on Android devicesRating: 
80%

In this article, you will find a detailed guide on how to connect to WireGuard VPN from Android.