On se bouge, on signe la pétition en masse :
— Non c’est Non, Monsieur Duplomb !
— Pour la santé, la sécurité, l’intelligence collective.

👨‍💻 about me home CV/Resume News 🖊️ Contact Codeberg Github LinkedIn 🏆 Best of LuaX (tools) pub bang ypp panda lsvg ldc yreq Fizzbuzz Calculadoira TPG picfg Belenos (intro) 🔀 Git Repos

Made in Europe

Raspberry Pi 4/5 setup for a minimalist personal local cloud

Raspberry Pi 4/5 setup for a minimalist personal local cloud

I don't like GAFAM's way of eating my personal data. So I decided to self-host my personal cloud to protect my privacy and have full powers on my data instead of Google.

Warning: picfg is a reduced version of rrpi that just provides file synchronization with Syncthing instead of Nextcloud.

This page describes a basic Raspberry Pi installation:

All being run on a small pretty Raspberry Pi ;-)

Hardware setup

The server will run 24/7 so running on a regular desktop PC is no good idea. We are going to install it on a Rapsberry Pi connected to the local network.

For this you will need:

Just plug everything and let's continue with the software setup.

Software setup

The software setup is completely made from a Linux PC connected to the same local network than the Raspberry Pi (Ethernet or WiFi).

The whole installation is scripted. My script is available here: picfg.

picfg connects to the Raspberry Pi with ssh. The Raspberry Pi hostname shall be given on the command line. The default host name is raspberrypi.local. The script shows a menu for a step-by-step installation.

WARNING: This script is provided for free and with no guaranty. Please read it before using it. It may fail and you may have to fix issues that are not described here.

picfg expects an optional argument to define the Raspberry Pi host and user names. The default hostname is raspberrypi.local and the default username is pi.

Installation of RaspiIO on the external SSD.

RaspiOS image download and configuration

  1. Run picfg and select Prepare.
  2. Wait for RaspiOS being downloaded (it is saved to ~/raspios).
  3. An admin password may be asked to mount and configure the image.
  4. Enter your WiFi SSID (leave it empty if you want to connect the Raspberry Pi to an Ethernet network).
    1. Enter your WiFi password.
    2. Enter your WiFi country (a two-letter country code).

Installation to the external SSD

  1. Run picfg and select Flash.
  2. Plug the SSD to the Linux PC (picfg should auto-detect it).
  3. Check the partition has been correctly detected and confirm (be sure the detected partition is actually the SSD or you may overwrite important data).
  4. Wait for the image to be completely written to the SSD.
  5. Unplug the SSD from the Linux PC and plug it to the Raspberry Pi.

First configuration of RaspiOS

We will start by configuring the Raspberry Pi with raspi-config.

  1. Run picfg and select Configure
  2. In the Raspberry Pi Configuration Tool some parameters can be changed:
    1. System Options / Password: change the pi user password and choose a strong password.
    2. System Options / Hostname: choose a different hostname (this hostname will be a parameter of picfg in the next steps, e.g. mypi).
    3. Interface Options / SSH: Enable SSH.
    4. Localisation Options / Locale.
    5. Localisation Options / Timezone.
    6. Advanced Options / Network Interface Names: Enable predictable network i/f names.

SSH configuration

To connect with SSH keys instead of password, you need to push your keys to the Raspberry Pi.

  1. Run ssh-keygen to create your SSH keys if you don't have one.
  2. Run picfg and select Keys to push your public key to the Raspberry Pi.
  3. Select Ssh to try your SSH configuration. You should now be connected to the Raspberry Pi.
  4. Run sudo reboot to reboot with the new configuration (hostname, ...).

From now on you shall start picfg with the right hostname (e.g. picfg mypi.local).

Installation/configuration of some basic packages

The following steps use a configuration files that must be created on the Linux PC used to configure the Raspberry Pi:

This file is a Lua script that defines the following parameters:

[picfg]
caddy = [
    { server = "public host name", root = "path to the local files" },
    ...
]

CDSoft programs

picfg will install some CDSoft programs precompiled for Raspberry Pi:

and also some great tools:

Configuration

  1. Run picfg mypi.local and select Install.

    This will install some Debian packages:

    and configure:

Forgejo

Forgejo can be used to host and manage Git repositories on the Raspberry Pi.

  1. Run picfg mypi.local and select Forgejo.

Caddy web server

The Caddy web server can be used to host an HTTPS server on the Raspberry Pi.

  1. Run picfg mypi.local and select Caddy.

UPnP

The Debian packet minidlna can be used to store and shared media files (music, video, ...). Shared files will be stored in /home/pi/dlna.

  1. Run picfg mypi.local and select UPnP.

Git server

GitHub and GitLab are great but if you need private repositories, you may want better privacy and control over your data.

And Git can be installed locally on a Raspberry Pi.

Git installation

The procedure described here is a summary of Build your own Raspberry Pi Git Server.

  1. Connect to the Raspberry Pi

    ssh pi@pi
  2. Ensure git is installed

    sudo apt update
    sudo apt upgrade
    sudo apt install git

Create a repository on the Raspberry Pi

  1. Create a directory

    mkdir -p /home/pi/git/hello
    cd /home/pi/git/hello
  2. Initialize the Git repository

    git init --bare

Create the repository on your PC

  1. Create the repository

    git init
    git remote add hello pi@git.example.com:/home/pi/git/hello
  2. Push the first commit

    git add .
    git commit -m "Initial commit"
    git push hello master
  3. Clone the repository on another PC

    git clone pi@git.example.com:/home/pi/git/hello

Example: Home Network Architecture

Overview

This document describes a home network that supports local web development and self-hosting, Git collaboration, and markdown-based note editing and sharing.

Network Topology

Example: Home Network Architecture

Devices and Roles

Internet

ISP Box

Local Router

Device Descriptions

Desktop PC (Workstation)

Laptop

Smartphone

Raspberry Pi 1 (Local Server)

Raspberry Pi 2 (Web Server)

File Synchronization (Files, textual notes, self-hosted website...)

Device Editor Sync Method Network Access
Desktop PC Neovim Syncthing LAN
Laptop Neovim Syncthing LAN
Smartphone Markor Syncthing Internet (relay/NAT)
Raspberry Pi 1 N/A (host) Syncthing LAN (sync hub)
Raspberry Pi 2 N/A (host) Syncthing LAN (sync hub)

Port Forwarding

Security Notes

WORK IN PROGRESS...

This script is constantly updated and the documentation may be outdated. The best is always to read the sources and change them to fit your requirements.

This site is powered by LuaX, bang, ypp, cdsoft.css and Pandoc.

Mirrors: cdelord.frchristophe.delord.free.frcdsoft.codeberg.page