In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to start Fedora CoreOS, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Now known as the DevOps era, operating systems seem to have less attention than tools. However, this does not mean that the operating system is not innovative. (editor's note: the variety of products offered by many distributions based on the Linux kernel is a good example). Fedora CoreOS has a unique idea of what the operating system of this DevOps era should be.
The concept of Fedora CoreOS
Fedora CoreOS (FCOS) is a combination of CoreOS Container Linux and Fedora Atomic Host. It is a compact stand-alone operating system that focuses on running containerized applications. Security is a top priority, and FCOS provides automatic updates with SELinux enhancements.
In order for automatic updates to work well, they need to be very robust and the goal is that the server running FCOS will not crash after the update. This is achieved by using different publishing streams (stable, testing, and next). Each stream is released every two weeks, and updates are promoted from one stream to another (next-> testing-> stable). In this way, updates that land in the stable stream have a chance to be tested for a long time.
Introduction
For this example, let's use the stable stream and a QEMU base image, which we can run as a virtual machine. You can use coreos-installer to download the image.
On your (Workstation) terminal, after updating the link to the image, run the following command (edit note: on Silverblue, the container-based coreos tool is the easiest way to try. Instructions can be found in https://docs.fedoraproject.org/en-US/fedora-coreos/tutorial-setup/, especially in the "Setup with Podman or Docker" section. ):
$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$ lsfedora-coreos-32.20200907.3.0-qemu.x86_64.qcow2 creates a configuration
To customize a FCOS system, you need to provide a configuration file that Ignition will use to configure the system. You can use this file to configure things such as creating users, adding trusted SSH keys, enabling systemd services, and so on.
The following configuration creates a core user and adds an SSH key to the authorized_keys file. It also creates a systemd service that uses podman to run a simple "hello world" container:
Version: "1.0.0" variant: fcospasswd: users:-name: core ssh_authorized_keys:-ssh-ed25519 my_public_ssh_key_hash fcos_keysystemd: units:-contents: | [Unit] 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 quay.io/cverna/hello ExecStop=/bin/podman rm-f hello [Install] WantedBy=multi-user.target enabled: true name: hello.service
After adding your SSH key to the configuration, save it as config.yaml. Next, use the Fedora CoreOS Config Transpiler (fcct) tool to convert this YAML configuration to a valid Ignition configuration (JSON format).
Install fcct directly from Fedora's repository, or get binaries from GitHub:
$sudo dnf install fcct$ fcct-output config.ign config.yaml installs and runs Fedora CoreOS
To run the image, you can use the libvirt stack. To install it on a Fedora system using the dnf package manager:
$sudo dnf install @ virtualization
Now let's create and run a Fedora CoreOS virtual machine:
$chcon-- verbose unconfined_u:object_r:svirt_home_t:s0 config.ign$ virt-install-- name=fcos\-- vcpus=2\-- ram=2048\-- import\-- network=bridge=virbr0\-- graphics=none\-- qemu-commandline= "- fw_cfg name=opt/com.coreos/config,file=$ {PWD} / config.ign"\-disk=size=20,backing_store=$ {PWD} / fedora-coreos-32.20200907.3.0-qemu.x86_64.qcow2
After the installation is successful, some information is displayed and a login prompt is provided:
Fedora CoreOS 32.20200907.3.0Kernel 5.8.10-200.fc32.x86_64 on an x86: 64 (ttyS0) SSH host key: SHA256:BJYN7AQZrwKZ7ZF8fWSI9YRhI++KMyeJeDVOE6rQ27U (ED25519) SSH host key: SHA256:W3wfZp7EGkLuM3z4cy1ZJSMFLntYyW1kqAqKkxyuZrE (ECDSA) SSH host key: SHA256:gb7/4Qo5aYhEjgoDZbrm8t1D0msgGYsQ0xhW5BAuZz0 (RSA) ens2: 192.168.122.237 fe80::5054:ff:fef7:1a73Ignition: user provided config was appliedIgnition: wrote ssh authorized keys file for user: core
The Ignition profile does not provide any passwords for core users, so you cannot log in directly through the console. (however, you can also configure passwords for users through Ignition configuration. )
Use the Ctrl +] keys to exit the console of the virtual machine. Then check to see if hello.service is running:
$curl http://192.168.122.237:8080Hello from Fedora CoreOS!
Using a preconfigured SSH key, you can also access the virtual machine and check the services running on it:
$ssh core@192.168.122.237$ systemctl status hello ● hello.service-Run a hello world web serviceLoaded: loaded (/ etc/systemd/system/hello.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-10-28 10:10:26 UTC; 42s agozincati, rpm-ostree and automatic updates
The zincati service uses automatic updates to drive rpm-ostreed.
Check the version of Fedora CoreOS currently running on the virtual machine and check that zincati found the update:
$ssh core@192.168.122.237$ rpm-ostree statusState: idleDeployments: ● ostree://fedora:fedora/x86_64/coreos/stableVersion: 32.20200907.3.0 (2020-09-23T08:16:31Z) Commit: b53de8b03134c5e6b683b5ea471888e9e1b193781794f01b9ed5865b57f35d57GPGSignature: Valid signature by 97A1AE57C3A2372CCA3A4ABA6C13026D12C944D0 $systemctl status zincati ● zincati.service-Zincati Update AgentLoaded: loaded (/ usr/lib/systemd/system/zincati.service; enabled; vendor preset: enabled) Active: active (running) since Wed 13:36:23 UTC; 7s ago … Oct 28 13:36:24 cosa-devsh zincati [1013]: [INFO] initialization complete, auto-updates logic enabledOct 28 13:36:25 cosa-devsh zincati [1013]: [INFO] target release '32.20201004.3.0' selected, proceeding to stage it. Zincati reboot...
After rebooting, we log in remotely again to check the new version of Fedora CoreOS:
$ssh core@192.168.122.237$ rpm-ostree statusState: idleDeployments: ● ostree://fedora:fedora/x86_64/coreos/stableVersion: 32.20201004.3.0 (2020-10-19T17:12:33Z) Commit: 64bb377ae7e6949c26cfe819f3f0bd517596d461e437f2f6e9f1f3c24376fd30GPGSignature: Valid signature by 97A1AE57C3A2372CCA3A4ABA6C13026D12C944D0ostree://fedora:fedora/x86_64/coreos/stableVersion: 32.20200907.3.0 (2009-23T08:16:31Z) Commit: b53de8b03134c5e6b683b5ea471888e9e1b193781794f01b9ed5865b57f35d57GPGSignature: Valid signature by 97A1AE57C3A2372CCA3A4ABA6C13026D12C944D0
Rpm-ostree status now shows two versions of Fedora CoreOS, one in the QEMU image and one in the updated version. With these two versions, you can use the rpm-ostree rollback command to roll back to the previous version.
Finally, you can make sure that the hello service is still running and provides the content:
$curl http://192.168.122.237:8080Hello from Fedora CoreOS! Delete a virtual machine
"to clean up afterwards, delete the virtual machine and related storage using the following command:"
$virsh destroy fcos$ virsh undefine-remove-all-storage fcos
Fedora CoreOS provides a solid and secure operating system for running applications in containers. It performs well in DevOps environments where hosts are recommended to be configured with declarative profiles. The ability to automatically update and roll back to previous versions of the operating system can bring a sense of peace of mind while the service is running.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.