Fedora CoreOS (FCOS) was born from the merger of CoreOS Container Linux and Fedora Atomic Host. It is a minimal and monolithic operating system focused on running containerized applications. FCOS offers automatic updates and SELinux. Each stream (stable, testing and next) is launched every 2 weeks and promoted from one stream to another (next -> testing -> stable). In this way, updates have the opportunity to be tested over a long period of time.
How do I use Fedora CoreOS? We can use the stable stream and a basic QEMU image that we can run as a virtual machine. You can use coreos-installer to download that image.
$ sudo dnf install coreos-installer $ coreos-installer download --image-url https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0 -qemu.x86_64.qcow2. xz $ xz -d fedora-coreos-32.20200907.3.0-qemu.x86_64.qcow2.xz $ ls fedora-core-32.20200907.3.0-qemu.x86_64.qcow2
To customize an FCOS system, you must provide a configuration file that will be used by Ignition to provision the system.
The following configuration creates a "basic" user, adds an SSH key to the authorized_key file, and creates a systemd service that uses podman to run a simple hello world container.
version: "1.0.0" variant: fcos passwd: users: - name: core ssh_authorized_keys: - ssh-ed25519 my_public_ssh_key_hash fcos_key systemd: units: - contents: | [United] Description = Run a hello world web service After = network-online.target Wants = network-online.target [Service] ExecStart = / bin / podman run --pull = always --name = hello --net = host -p 8080: 8080 quay.io/cverna/hello ExecStop = / bin / podman rm -f hello [Install] WantedBy = multi-user.target enabled: true name: hello.service
After adding the SSH key to the configuration, save it as config.yaml, then use the Fedora CoreOS Config Transpiler (fcct) tool to convert this YAML configuration to a valid configuration (JSON format).
$ sudo dnf install fcct $ fcct -input config.yaml -output config.ign
To run the image, you can use the libvirt stack.
$ sudo dnf install virt-install
To clean, the following commands will delete the VM and the associated storage space.
$ virsh destroy fcos $ virsh undefine --remove-all-storage fcos