Kategorie
Installation of Pi-Cloud on Raspberry Pi 5
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
In the Configure workbench section, change the port from 80 to 81.
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
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.
Fill in the following details. Essentially, select only the MariaDB network and change the database name and login details. Use your own password!
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.
Fill in the following details. Simply select only the MariaDB network.
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!
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.
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:
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/
2) Create the folders diskA and diskB
mkdir diskA
mkdir diskB
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:
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
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
Change the default data folder to diskA
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
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