From Fedora Project Wiki
(Created page with "{{QA/Test_Case |description=Install Fedora CoreOS as a virtual machine with Podman & Docker |setup= # Install '''podman''' by running <code>sudo dnf install podman -y</code> #...")
 
No edit summary
Line 27: Line 27:
                         quay.io/coreos/ignition-validate:release'
                         quay.io/coreos/ignition-validate:release'
</pre>
</pre>
## <pre>
<pre>
$ alias fcct='podman run --rm --tty --interactive \
$ alias fcct='podman run --rm --tty --interactive \
             --security-opt label=disable        \
             --security-opt label=disable        \
Line 35: Line 35:


# Using '''coreos-installer''' to download and decompress the image <code> $coreos-installer download -p qemu -f qcow2.xz --decompress </code>
# Using '''coreos-installer''' to download and decompress the image <code> $coreos-installer download -p qemu -f qcow2.xz --decompress </code>
#  
# Execute <code> touch fcct-autologin.yaml </code> and make sure it has the following content
<pre>
variant: fcos
version: 1.2.0
systemd:
  units:
    - name: serial-getty@ttyS0.service
      dropins:
      - name: autologin-core.conf
        contents: |
          [Service]
          # Override Execstart in main unit
          ExecStart=
          # Add new Execstart with `-` prefix to ignore failure`
          ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
storage:
  files:
    - path: /etc/hostname
      mode: 0644
      contents:
        inline: |
          test
    - path: /etc/profile.d/systemd-pager.sh
      mode: 0644
      contents:
        inline: |
          # Tell systemd to not use a pager when printing information
          export SYSTEMD_PAGER=cat
    - path: /etc/sysctl.d/20-silence-audit.conf
      mode: 0644
      contents:
        inline: |
          # Raise console message logging level from DEBUG (7) to WARNING (4)
          # to hide audit messages from the interactive console
          kernel.printk=4
 
</pre>
 
# Run <code> $ fcct --pretty --strict fcct-autologin.yaml --output autologin.ign </code> to convert the above yaml into a ignition config by '''fcct'''
# Setup the correct SELinux label to allow access to the config <code>$ chcon --verbose --type svirt_home_t autologin.ign</code>
# Start FCOS VM by running
<pre>
virt-install --name=fcos --vcpus=2 --ram=2048 --os-variant=fedora-coreos-stable \
    --import --network=bridge=virbr0 --graphics=none \
    --qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${PWD}/autologin.ign" \
    --disk=size=20,backing_store=${PWD}/fedora-coreos-''XXYYYYYZZZZZ''.qcow2
</pre>
 
 


|results=
|results=
Line 41: Line 89:
# You can read the IP address of the machine from the serial console.
# You can read the IP address of the machine from the serial console.
# You can connect to the machine via SSH.
# You can connect to the machine via SSH.
# The linked documentation is clear, all steps are understandable, and nothing important is missing from it.
}}
}}


[[Category:CoreOS Test Cases]]
[[Category:CoreOS Test Cases]]

Revision as of 14:14, 8 February 2021

Description

Install Fedora CoreOS as a virtual machine with Podman & Docker

Setup

  1. Install podman by running sudo dnf install podman -y
  2. Download and verify the desired image for QEMU

How to test

  1. Create an working directory by running mdkir ~/coreos && cd ~/coreos. Please skip this step if you already have a working directory.
  2. Download the latest Fedora CoreOS QCOW2 image, we will grab coreos-installer by runningpodman pull quay.io/coreos/coreos-installer:release
  3. Generate Ignition configuration from Fedora CoreOS Config files, we will grab fcct by runningpodman pull quay.io/coreos/fcct:release
  4. Validate Ignition configuration files, we will need ignition-validate by running podman pull quay.io/coreos/ignition-validate:release
  5. To make config easier, add the following alias
$ alias coreos-installer='podman run --pull=always            \
                        --rm --tty --interactive            \
                        --security-opt label=disable        \
                        --volume ${PWD}:/pwd --workdir /pwd \
                        quay.io/coreos/coreos-installer:release'
$ alias ignition-validate='podman run --rm --tty --interactive \
                         --security-opt label=disable        \
                         --volume ${PWD}:/pwd --workdir /pwd \
                         quay.io/coreos/ignition-validate:release'
$ alias fcct='podman run --rm --tty --interactive \
            --security-opt label=disable        \
            --volume ${PWD}:/pwd --workdir /pwd \
            quay.io/coreos/fcct:release'
  1. Using coreos-installer to download and decompress the image $coreos-installer download -p qemu -f qcow2.xz --decompress
  2. Execute touch fcct-autologin.yaml and make sure it has the following content
variant: fcos
version: 1.2.0
systemd:
  units:
    - name: serial-getty@ttyS0.service
      dropins:
      - name: autologin-core.conf
        contents: |
          [Service]
          # Override Execstart in main unit
          ExecStart=
          # Add new Execstart with `-` prefix to ignore failure`
          ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
storage:
  files:
    - path: /etc/hostname
      mode: 0644
      contents:
        inline: |
          test
    - path: /etc/profile.d/systemd-pager.sh
      mode: 0644
      contents:
        inline: |
          # Tell systemd to not use a pager when printing information
          export SYSTEMD_PAGER=cat
    - path: /etc/sysctl.d/20-silence-audit.conf
      mode: 0644
      contents:
        inline: |
          # Raise console message logging level from DEBUG (7) to WARNING (4)
          # to hide audit messages from the interactive console
          kernel.printk=4

  1. Run $ fcct --pretty --strict fcct-autologin.yaml --output autologin.ign to convert the above yaml into a ignition config by fcct
  2. Setup the correct SELinux label to allow access to the config $ chcon --verbose --type svirt_home_t autologin.ign
  3. Start FCOS VM by running
virt-install --name=fcos --vcpus=2 --ram=2048 --os-variant=fedora-coreos-stable \
    --import --network=bridge=virbr0 --graphics=none \
    --qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${PWD}/autologin.ign" \
    --disk=size=20,backing_store=${PWD}/fedora-coreos-''XXYYYYYZZZZZ''.qcow2

Expected Results

  1. The system runs in a virtual machine according to the instructions.
  2. You can read the IP address of the machine from the serial console.
  3. You can connect to the machine via SSH.