Bertram-Fedora Setup
Deprecated
A step-by-step guide on how to setup Bertram.
Table of Contents
- Bertram-Fedora Setup
- 01 Install Fedora Server
- 02 Update the server
- 03 Create an SSH key
- 04 Configure Storage
- 05 Install Docker
- 06 Install and configure Portainer
01 Install Fedora Server
Download Fedora Server Edition and install it on the target machines boot drive. After installation you should be able to reach the Cockpit web-interface on port 9090. Currently Bertrams Cockpit can be reached at https://192.168.178.26:9090 (accept risks because it is a self-signed SSL certificate)
02 Update the server
In Cockpit under Tools goto Software Updates and click Install all updates and check Reboot after completion. Alternitatively run sudo dnf update -y && sudo reboot.
Enable auto-updates
In Cockpit go to Software Updates and enable automatic updates. It will download and install the package dnf-automatic. Afterwards set it to update all packages everyday at 5:00 in the morning.
Disable Sleep on lid-close
Edit the logind.conf file and restart the systemd-logind service:
sudo nano /etc/systemd/logind.conf- Find and edit the following lines (remove the
#and set toignore):HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore IdleAction=ignore sudo systemctl restart systemd-logind
Install additional software
sudo dnf install nano powertop -y
Disable unneeded services
Disabling unneeded services can reduce power consumption.
sudo systemctl mask bluetooth.service
Configure HDD spin-down
Spinning down disks after 10 minutes of use to reduce power consumption and noise.
- Install
hd-idle:sudo dnf install hd-idle -y - Find the UUIDs of the drives you want to spin-down. For example with
sudo blkid. Here we are going to use the PARTUUID instead since in a BTRFS raid both disks share the same UUID. - Edit
/etc/sysconfig/hd-idleset the following asHD_IDLE_OPTS:-i 0 -a /dev/disk/by-partuuid/0410740d-55e2-45b6-8580-c6185db9e423 -i 600 -a /dev/disk/by-partuuid/97a3764e-2086-4a10-8f57-830fcbf40b42 -i 600 -l /var/log/hd-idle.logThis will spin-down (only the) both drives after 600 seconds (10 minutes) of inactivity and log all spin-downs and spin-ups in
/var/log/hd-idle.log. - Enable and start the
hd-idle.service:sudo systemctl enable hd-idle.service && sudo systemctl start hd-idle.service
03 Create an SSH key
Work in progress.
04 Configure Storage
Overall the setup of Bertram includes a 250GB boot SSD formated as XFS (Default on Fedora Server) and two 5TB HDDs (BTRFS) in RAID 1. Later we can add a SSD as read cache.
Why BTRFS?
We could use Cockpits build-in raid capabilities, which as far as I now relies on mdadm, however the USB-HDD do not show up in the raid creation dialog within Cockpit. I do not know whether that is due to them being USB devices or improper configuration. This means we have to use the terminal anyway, so we might as well just use BTRFS as it has some extra benefits over mdadm. However it might be less mature.
Setup
Reference: BTRFS Wiki
- If not installed, install BTRFS user-space utils:
sudo dnf install btrfs-progs -y Check out the
Storagetab in Cockpit or runlsblkto find the correct disks:
Here they are /dev/sdband/dev/sdc. The ones with numbers indicate partitions on the disks.- Create the raid:
sudo mkfs.btrfs -d raid1 -m raid1 -f -L BERTRAM_STORAGE /dev/sdb1 /dev/sdc1This will format the drives to a BTRFS RAID1 and label them as BERTRAM_STORAGE. Note that
-fwill force the formatting regardless of any prior formats or data! Make sure the listed partitions are correct!
To mount the new raid storage, just mount one of the drives to
/storage- Reboot after mount to make sure the drives are mounted at boot.
Add an SSD cache
We can use LVM to create a logical volume with our raid storage and SSD(s) to enable caching. Work in progress.
05 Install Docker
Reference: Docker Documentation
Remove existing installations (if there are any):
sudo dnf remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engineAdd Docker repository:
sudo dnf -y install dnf-plugins-core && \ sudo dnf config-manager \ --add-repo \ https://download.docker.com/linux/fedora/docker-ce.repoInstall the Docker engine:
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-pluginEnable and start the Docker service:
sudo systemctl enable docker && sudo systemctl start dockerVerify that it works by running:
sudo docker run hello-world
06 Install and configure Portainer
Reference: Portainer Documentation
Each application on Bertram will run in their own Docker container. Portainer is an easy web-based GUI to manage all container and to create new ones.
Install
- Create the volume that Portainer Server will use to store its database:
sudo docker volume create portainer_data - Download and install the Portainer Server container:
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latestThe Portainer web-interface should now be available on port
9443: https://192.168.178.26:9443
Configuration
- Create a new docker network for all apps that we will set up:
sudo docker network create bertram_network - Under
Homeselect thelocalenviroment. Then click onSettingsand underApp Templatespaste this URL to get all linuxserver.io containers as templates:https://raw.githubusercontent.com/technorabilia/portainer-templates/main/lsio/templates/templates-2.0.jsonThe templates are taken from Technorabilia’s GitHub Repo and should now be available under
App Templates. - Head over to Bertram Applications to find out, how to set up applications on Bertram.