Deploying YunoHost v4.1.7.2 onto the µSD-card

This is the first blog post in this series about setting up my homelab as a selfhosted hub for my Web2.0 activity, including selfhosting software to replace Google, Apple, Facebook, Amazon, and Microsoft ( #gafam ) in my online life. In this post I will be downloading the operating system that I will use, and burning it to a µSD-card.

ℹ️ Throughout this step-by-step guide, the
red text
indicates commands which are to be entered in the terminal, by the user.

  • Stage: Deploy test-fmds.noho.st
  • Milestone: YunoHost v4.3.4.2 is fully installed on test-fmds.noho.st
  • Task: Deploying YunoHost v4.1.7.2 onto the µSD-card

Deploying YunoHost v4.1.7.2 onto the µSD-card.

Hardware that I'll be using for this task.

Raspberry Pi 4B – This is the 8GB model, top-of-the-range device, which I purchased last year for $ⁿᶻ125.00, plus the case and fan. This particular device is in an official red and white Raspberry Pi plastic case, with an official heatsink and fan.


µSD-card – This is a 16GB SanDisk Ultra micro-SD card which I had laying around at home, amongst all of my spare parts. I think this particular one used to be installed in a tablet PC at one stage. I tend to move stuff around and recycle it often. I know this isn't a good practice when setting up a server, but I have to live within tight budget constraints as well, being elderly and retired, and on a fixed weekly income now.


SD-card reader – This is a USB2.0, Transcend TS-RDP5K SD-card reader. It is part of the reason that the start of my project was delayed. This handy piece of tech had gone missing in my home somewhere, and I needed to find it before I could start my project!


Laptop – My trusty Lenovo ThinkPad T400 laptop is being used to set up the Raspberry Pi, and it will ultimately become one of the client machines connecting to the new server. This is a run-of-the-mill business laptop, with a 2.26GHz Intel® Core™2 Duo processor, 4GB of RAM, and a Seagate ST9250315AS 2.5" 250GB Hard Drive (spinning rust).

How it all begins.

I'm at my laptop, logged in to the operating system, which is currently still running Ubuntu 20.04 LTS (Focal Fossa) for now. The first thing that I reach for is my µSD-card and the card reader. I know that there will be some crap on it from the last time I used it, but I am diligent with my backups, so I'm unafraid to blank the card and start again. The first command I issue from the command line terminal will do just that. First, I need to ensure that I'm working on the correct drive. I'd hate to wipe out my booting system!

user@laptop:~$ 
lsblk
( ... output trimmed ... ) sda 8:0 0 232.9G 0 disk └─sda1 8:1 0 232.9G 0 part / sdb 8:16 1 29.5G 0 disk ├─sdb1 8:17 1 256M 0 part /media/user/boot └─sdb2 8:18 1 29.3G 0 part /media/user/rootfs

Okay, so it looks like I am after the sdb drive, in my case. If you are following along, it is important that you get this right for your own environment!

user@laptop:~$ 
sudo dd if=/dev/zero of=/dev/sdb bs=4096 status=progress
[sudo] password for user: 31687921664 bytes (32 GB, 30 GiB) copied, 2272 s, 13.9 MB/s dd: error writing '/dev/sdb': No space left on device 7737089+0 records in 7737088+0 records out 31691112448 bytes (32 GB, 30 GiB) copied, 2272.42 s, 13.9 MB/s

⚠️ Can anyone spot the mistake that I have made already? In my case, it isn't a major issue, and I can carry on. But for you, this might be a disaster! Hint: compare the capacity of the µSD-card that I just blanked out.

Now that my µSD-card is completely blank, it is time to put the operating system onto it. I will be using the YunoHost v4.1.7.2 distribution initially, and then I will upgrade it to YunoHost v4.3.4.2 later. The reason that I'm installing v4.1.7.2 initially here is that it is the latest bundled version for the Raspberry Pi 4+ at present. If you are reading this in the future and following these step-by-step instructions, it is always best to use which ever installation package is the latest for your hardware platform. At present, the YunoHost maintainers haven't packaged the latest (v4.3.4.2) bundle for the Raspberry Pi yet, so it is an upgrade option only for me, once I have v4.1.7.2 installed.

Before we begin downloading, we need to find a place to put everything on the local computer, in my case, on my laptop. I have pre-created a folder for this purpose, and I will just change to it now...

user@laptop:~$ 
cd ~/dev/rpi/deployment/test-fmds.noho.st

Next we are going to get the installation package itself. You can, of course, do this all from the Web, but I prefer to use the terminal for this, as it is self-documenting, I can just copy and paste the output from the terminal.

user@laptop:~$ 
wget https://build.yunohost.org/yunohost-buster-4.1.7.2-rpi-stable.img.zip
--2022-01-16 14:03:07-- https://build.yunohost.org/yunohost-buster-4.1.7.2- rpi-stable.img.zip Resolving build.yunohost.org (build.yunohost.org)... 2001:910:1410::1, 80.67.172.144 Connecting to build.yunohost.org (build.yunohost.org)|2001:910:1410::1|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 682245487 (651M) [application/zip] Saving to: ‘yunohost-buster-4.1.7.2-rpi-stable.img.zip’ yunohost-buster-4.1.7.2-rpi-sta 100%[====================================================>] 650.64M 101KB/s in 64m 50s 2022-01-16 15:07:59 (171 KB/s) - ‘yunohost-buster-4.1.7.2-rpi-stable.img.zip’ saved [682245487/682245487]

Now we will get the checksum file for that installation package...

user@laptop:~$ 
wget https://build.yunohost.org/yunohost-buster-4.1.7.2-rpi-stable.img.zip.sha256sum
--2022-01-16 16:13:52-- https://build.yunohost.org/yunohost-buster-4.1.7.2-rpi-stable.img.zip.sha256sum Resolving build.yunohost.org (build.yunohost.org)... 2001:910:1410::1, 80.67.172.144 Connecting to build.yunohost.org (build.yunohost.org)|2001:910:1410::1|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 109 [application/octet-stream] Saving to: ‘yunohost-buster-4.1.7.2-rpi-stable.img.zip.sha256sum’ yunohost-buster-4.1.7.2-rpi-sta 100%[====================================================>] 109 --.-KB/s in 0s 2022-01-16 16:13:54 (6.99 MB/s) - ‘yunohost-buster-4.1.7.2-rpi-stable.img.zip.sha256sum’ saved [109/109]

...and get the GPG signature for the installation package...

user@laptop:~$ 
wget https://build.yunohost.org/yunohost-buster-4.1.7.2-rpi-stable.img.zip.sig
--2022-01-16 16:15:29-- https://build.yunohost.org/yunohost-buster-4.1.7.2-rpi-stable.img.zip.sig Resolving build.yunohost.org (build.yunohost.org)... 2001:910:1410::1, 80.67.172.144 Connecting to build.yunohost.org (build.yunohost.org)|2001:910:1410::1|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 310 [application/octet-stream] Saving to: ‘yunohost-buster-4.1.7.2-rpi-stable.img.zip.sig’ yunohost-buster-4.1.7.2-rpi-sta 100%[====================================================>] 310 --.-KB/s in 0s 2022-01-16 16:15:30 (14.4 MB/s) - ‘yunohost-buster-4.1.7.2-rpi-stable.img.zip.sig’ saved [310/310]

Now that we have everything we need to get started, we can proceed with the checking and then burning the operating system onto the µSD-card.

Verifying and validating.

The next two steps are vitally important for making sure that the package we downloaded in the previous step is both internally consistent (eg. the file downloaded correctly), and that it has not been modified in any way since it was published by the package maintainers. This involves both verifying and validating the downloaded package. Most people will know how to verify a package using a checksum. However, what happens if, after the package was released, some nefarious person has modified the code, re-uploaded it, with a new checksum? This is where validating comes in to play.

To verify our downloaded package, we simply use the sha256sum command...

user@laptop:~$ 
sha256sum -c yunohost-buster-4.1.7.2-rpi-stable.img.zip.sha256sum
yunohost-buster-4.1.7.2-rpi-stable.img.zip: OK

That was quick and easy. The next step is a little more involved. We will now validate our downloaded package. To achieve this, we will first need to know where the YunoHost package maintainers official public key is kept. I had trouble finding this initially, but in this post on the YunoHost forums I was given the correct location, of https://forge.yunohost.org/yunohost.asc. Now we can download the package maintainers' official public key, with the command...

user@laptop:~$ 
wget https://forge.yunohost.org/yunohost.asc
--2022-01-16 16:23:53-- https://forge.yunohost.org/yunohost.asc Resolving forge.yunohost.org (forge.yunohost.org)... 2001:910:1410::1, 80.67.172.144 Connecting to forge.yunohost.org (forge.yunohost.org)|2001:910:1410::1|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2138 (2.1K) [application/octet-stream] Saving to: ‘yunohost.asc’ yunohost.asc 100%[====================================================>] 2.09K --.-KB/s in 0s 2022-01-16 16:23:56 (118 MB/s) - ‘yunohost.asc’ saved [2138/2138

Now that we have the public key as a file, let's go ahead and add it to our GPG keychain, using the command...

user@laptop:~$ 
gpg --import yunohost.asc

As we now have the proper key in our GPG keychain, we can verify the key file and the package itself that we downloaded earlier, by using the command...

user@laptop:~$ 
gpg --verify yunohost-buster-4.1.7.2-rpi-stable.img.zip.sig yunohost-buster-4.1.7.2-rpi-stable.img.zip
gpg: Signature made Mon 22 Feb 2021 12:36:41 NZDT gpg: using RSA key 1904C5B42E4856DCD4E9CF96360AAF3259A3E6FF gpg: Good signature from "YunoHost <build@yunohost.org>" [full]

That is it! We are ready now to burn the YunoHost v4.1.7.2 package onto our µSD-card itself!

Getting YunoHost onto the µSD-card.

Now that we have downloaded, verified, and validated our operating system, it is time to put it onto the µSD-card, so that we can boot it up. We'll be using the same dd tool that we used earlier for blanking the µSD-card, but this time we'll use it to put data onto the card, instead. First, let's extract the zip file that we have downloaded, using the command...

user@laptop:~$ 
unzip yunohost-buster-4.1.7.2-rpi-stable.img.zip
Archive: yunohost-buster-4.1.7.2-rpi-stable.img.zip inflating: 2021-02-21-yunohost-lite-qemu.img

Now, as a final step here, we will be burning the extracted file onto our µSD-card. Make absolutely sure that we are writing to the correct device, with the lsblk command again, if need be. Then use the command...

user@laptop:~$ 
sudo dd if=2021-02-21-yunohost-lite-qemu.img of=/dev/sdb bs=64k oflag=dsync status=progress
[sudo] password for user: 2395996160 bytes (2.4 GB, 2.2 GiB) copied, 227 s, 10.6 MB/s 36672+0 records in 36672+0 records out 2403336192 bytes (2.4 GB, 2.2 GiB) copied, 227.628 s, 10.6 MB/s

We should now have a bootable µSD-card containing YunoHost v4.1.7.2 on it, ready to be put into our Raspberry Pi and booted up for the first time! That will be the subject of my next blog post in this series. In the meantime, if you have any questions or comments about this procedure so far, please leave me a comment on this post. If you have come here from the YunoHost user community and don't yet have a HIVE account, you can get one here.

Image Credits

  1. post-head.png – Remix created by @frittro, using elements by @pantone801; an image from Pixabay by @perezvcking; and various "fair use" icons and logos.
  2. Various "fair use" organisation and company logos, including Hive, Raspberry Pi, YunoHost, etc.
  3. File:Raspberry Pi 4 Model B - Side.jpg. (2022, January 9). Wikimedia Commons, the free media repository. Retrieved 08:17, January 18, 2022 from Wikipedia.
  4. sd-card.png, reader.png, and laptop.png – Original photos by @frittro.
  5. maori-divider.png – Original image by @pantone801. Remix created by @frittro.
  6. frittro-maori-footer.png – Remix created by @frittro, using elements by @pantone801.
H2
H3
H4
3 columns
2 columns
1 column
12 Comments
Ecency