In this guide, you’ll learn how to:
-
Generate RSA SSH keys
-
Generate YAML Butane file
-
Convert YAML Butane file into Ignition File needed for CoreOS installation
-
Locally share your Ignition File with the CoreOS Install
-
Install Fedora CoreOS
-
Layer in Firewalld with
rpm-ostree -
Setup Firewall rules and DNS
-
Setup Pi-hole for network level ad-blocking
Fedora CoreOS is great for turning a VM (or an old laptop, in my case) into a single-task appliance. In this example we’ll make a VM our Pi-hole DNS server running on CoreOS, but you could easily swap Pi-hole for whatever you need.
Pre-reqs:
-
Host PC (I’m running Fedora Silverblue)
-
VM (or old laptop)
-
Fedora CoreOS Bare Metal ISO: https://fedoraproject.org/coreos/download?stream=stable
Generate RSA SSH key
SSH keys are the more secure future of passwords. Once your key is generated, you add it to the YAML file we’ll set up in the next step. You’ll be prompted for an optional passphrase for another layer of security. In this example, I’ll leave it empty.
To generate the key, open a Terminal and type:
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa
Just remember your SSH key lives under ~/.ssh. You’ll want the contents of id_rsa.pub for the next step.
Create the Butane YAML Config File
Next, create the Butane YAML file. I’m keeping it super simple and only including what’s needed for SSH to work after install. If you’re a CoreOS pro, feel free to add more. Under my Downloads folder, I created a coreos folder, so the path is ~/Downloads/coreos. I named the config file config.bu. You can name it whatever you like, just keep the .bu extension. Open the id_rsa.pub file from earlier (I use KWrite or VS Code), copy its contents, and paste them into config.bu.
Here’s what it should look like (replace XXX with your id_rsa.pub SSH key):
variant: fcos version: 1.3.0 passwd: users: - name: core ssh_authorized_keys: - ssh-rsa XXX
Save that bad boy out, and we are ready for the next step.
Convert Butane YAML File into CoreOS Ignition File
Our YAML file is easy for us to read, but CoreOS needs an ignition file, which is formatted in JSON. To convert it, we’ll run Butane in a container. Change directory into ~/Downloads/coreos again.
Then run this command exactly as you see it:
podman run -i --rm quay.io/coreos/butane:release --strict < config.bu > coreos.ign
Please note: The arrow space filename space arrow is required. I’d copy/paste this as long as your file is named config.bu like mine.
Congrats! You’ve created the ignition file Fedora CoreOS needs to install. 90% of the heavy lifting is over. :)
Locally share your Ignition File
The CoreOS install needs a URL pointing to your ignition file. Change directory into ~/Downloads/coreos if you aren’t there already. We’ll set up a temporary web host to share coreos.ign with the VM/old laptop. Only internal devices can see it, as long as you aren’t forwarding port 8000 in your router. Please don’t do that :) You’ll need your Host PC’s IP address for the ignition file URL.
To find your IP Address on the Host PC, open a Terminal and type:
ip addr
Make note of your Host IP. For this example we’ll use 192.168.1.8. Next, temporarily disable the firewall so the install doesn’t hit 404 access denied errors fetching the file.
To disable the firewall, open a Terminal and type:
sudo systemctl stop firewalld
Now fire up the web host to share the ignition file. Open a Terminal and type:
python3 -m http.server
I’m using Fedora 41 Silverblue. If your distro doesn’t include python, install it before running the command above.
Everything so far has been on the Host PC. Now move over to the VM or old laptop to install Fedora CoreOS.
Install Fedora CoreOS
Boot the Bare Metal ISO you downloaded earlier. You’ll get a black screen and a Terminal prompt. First, check your drive names with lsblk. Replace /dev/sdX with the correct drive you wish to target. For VMs, this is normally /dev/vda.
To install CoreOS, run:
sudo coreos-installer install /dev/sdX –ignition-url http://192.168.1.8:8000/coreos.ign –insecure-ignition
Remember to replace X with your drive. This is normally sda, but it’s better to run lsblk and be 100% sure.
Once the install completes, type shutdown now. Back on the Host PC, stop the web host by pressing CTRL + C in its terminal, then re-enable the firewall.
To re-enable the firewall, please type in a Terminal: sudo systemctl start firewalld
To ensure the firewall is indeed running again on your Host PC, please check in a Terminal with: sudo systemctl status firewalld
Congrats, now we can SSH into our VM or old laptop to finish setting it up. :)
Layer in Firewalld with rpm-ostree
CoreOS doesn’t come with firewalld by default. Let’s change that, but first SSH into the fresh CoreOS install. Open a Terminal and type: ssh core@192.168.1.8
Type yes to accept the key pair. If you set a passphrase earlier, you’ll enter that too (we didn’t). You’ll then see something like this:
chris@hostpc:/var/home/chris$ ssh core@192.168.1.8 Fedora CoreOS 41.20241215.3.0 Tracker: https://github.com/coreos/fedora-coreos-tracker Discuss: https://discussion.fedoraproject.org/tag/coreos Last login: Sun Jan 19 22:21:47 2025 from HOSTPC_IP_ADDRESS_HERE core@fedora:~$
Think of rpm-ostree a lot like dnf for Fedora. Since Silverblue is atomic, we can’t install packages with dnf like a normal Fedora install. We layer them on top of the base image instead.
To install firewalld, open a Terminal and type: sudo rpm-ostree install firewalld
Once that completes, reboot, SSH back in, and we’ll set up the firewall rules.
Setup Firewall Rules and DNS
Setting up firewalld rules is simple. In your SSH session, copy and paste these:
sudo firewall-cmd --zone=FedoraServer --add-port=80/tcp sudo firewall-cmd --zone=FedoraServer --add-port=443/tcp sudo firewall-cmd --zone=FedoraServer --add-port=53/tcp sudo firewall-cmd --zone=FedoraServer --add-port=53/udp sudo firewall-cmd --zone=FedoraServer --add-port=67/udp sudo firewall-cmd --permanent --zone=FedoraServer --add-port=53/udp sudo firewall-cmd --permanent --zone=FedoraServer --add-port=53/tcp sudo firewall-cmd --permanent --zone=FedoraServer --add-port=443/tcp sudo firewall-cmd --permanent --zone=FedoraServer --add-port=67/udp sudo firewall-cmd --permanent --zone=FedoraServer --add-port=80/tcp
Next, set up DNS. My network device is enp1s0, but yours may be different. Run ip addr and it shows to the right of 1, 2, 3… depending on how many devices you have. Then type the following (I’d copy/paste it, editing the device name in KWrite/VS Code if needed):
sudo nmcli device modify enp1s0 ipv4.addresses 192.168.1.8/24 sudo nmcli device modify enp1s0 ipv4.gateway 192.168.1.1
sudo nmcli device modify enp1s0 ipv4.dns "8.8.8.8 8.8.4.4" sudo systemctl disable systemd-resolved sudo systemctl stop systemd-resolved sudo unlink /etc/resolv.conf sudo systemctl restart NetworkManager
Setup Pi-hole
CoreOS is now ready for its intended use. Let’s get Pi-hole running. First, create the two volumes Pi-hole needs. Open a Terminal and type:
sudo podman volume create pihole_pihole sudo podman volume create pihole_dnsmasq
Next, let’s pull the image down. Open a Terminal and type:
sudo podman pull docker.io/pihole/pihole
Now run it. My timezone is America/Denver, so change that to yours, and please change the WEBPASSWORD. Open a Terminal and type:
sudo podman run --name=pihole \ --hostname=pi-hole \ --cap-add=NET_ADMIN \ --dns=127.0.0.1 \ --dns=1.1.1.1 \ -e TZ=America/Denver \ -e SERVERIP=192.168.1.8 \ -e WEBPASSWORD=CHANGETHIS \ -e DNS1=1.1.1.1 \ -e DNS2=1.0.0.1 \ -e DNSSEC=true \ -e CONDITIONAL_FORWARDING=true \ -e CONDITIONAL_FORWARDING_IP=192.168.1.1 \ -e CONDITIONAL_FORWARDING_DOMAIN=lan \ -e TEMPERATUREUNIT=c \ -v pihole_pihole:/etc/pihole:Z \ -v pihole_dnsmasq:/etc/dnsmasq.d:Z \ -p 80:80/tcp \ -p 443:443/tcp \ -p 67:67/udp \ -p 53:53/tcp \ -p 53:53/udp \ docker.io/pihole/pihole
Congrats! You’ve just setup Pi-hole on CoreOS!
BONUS: If using a laptop
If you’re using an old laptop like me, you don’t want to keep the lid open all the time. To fix that, open a Terminal and type:
sudo mkdir -p /etc/systemd/logind.conf.d sudo nano /etc/systemd/logind.conf.d/ignore-lid-switch.conf
Here’s the contents of the ignore-lid-switch.conf (I would copy/paste this):
[Login] HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore
Again, you can CTRL + O to write your changes OUT. CTRL + X to EXIT.
Now restart the login service.
Open a Terminal and type: sudo systemctl restart systemd-logind
Sources
https://docs.fedoraproject.org/en-US/fedora-coreos/
https://jreypo.io/2021/03/12/running-pihole-as-a-podman-container-in-fedora/
https://www.portainer.io/blog/from-zero-to-production-with-fedora-coreos-portainer-and-wordpress-in-7-easy-steps