订阅内容
Linux 

In January 2021, Red Hat announced simplifications to our existing, no-cost individual developer subscription which includes Red Hat Enterprise Linux (RHEL). Since the announcement about the updated Red Hat Developer Subscription for Individuals, I've seen some confusion among people who are new to the Red Hat ecosystem. This includes questions about subscriptions and subscription-manager. Read on to learn more about this subscription to clear up any confusion!

Installing Red Hat Enterprise Linux is not much different than many other Linux distributions. The typical installation scenario is to download an installation DVD, attach or physically insert it, and boot the installer. 

Sign up for the Red Hat Developer program

To download the installation medium, you must join the free Red Hat Developer program. It takes just minutes via e-mail or with single sign-on via your existing Google, Twitter, GitHub, LinkedIn or other accounts. Joining the Red Hat Developer program creates a Red Hat account for you—that username and password will be required during the Red Hat Enterprise Linux installation process.

Red Hat Enterprise Linux packages and update information is provided by Red Hat CDN via HTTPS protocol requiring a valid yum SSL client certificate. Once a system is registered during the install process, subscription-manager handles certificate management and configures yum with it. It also makes sure that certificate is renewed before it expires, and everything is fully transparent once registered. System registration status can be monitored from the management views of the Red Hat Customer Portal—all you need is the same Red Hat account username and password.

To install Red Hat Enterprise Linux from DVD, provide your Red Hat account username and password when asked by the Anaconda installer. In this post, however, I will focus on installing RHEL from an official image. I will show commands for subscribing and launching a VM on a RHEL host, but the instructions are the same for other virtualization environments because RHEL provides utilities to convert images into different formats.

To start off, download the your desired Red Hat Enterprise Linux image (version 8.3 at the time of writing) from the Red Hat Developer program. To use the image in a cloud environment like Red Hat OpenStack simply upload the image and launch it. If you wish to use the image with AWS, Azure or other providers you may need to convert it to a format supported by those cloud providers.

The image is cloud-init ready, so you can seed the instance with data like usernames, passwords and/or ssh-keys. Note that the root account is intentionally locked; there is no way to log in without seeding an initial information.

Using virt-customize

In our case, we want to prepare the image for the initial launch. Although it's technically possible to use cloud-init for the initial seed, for example in the Red Hat Enterprise Virtualization environment, let's try a different approach provided by a tool called virt-customize, which ships with Red Hat Enterprise Linux and other Linux distributions.

The utility mounts an image and performs various operations like changing files, installing or updating packages, creating user accounts, setting up passwords, SSH public keys and so on. In our case, we want to uninstall cloud-init so it won't attempt to configure the instance during the initial boot, set a hostname and a root password.

Let's also provide additional arguments to register the instance to the Red Hat portal, credentials to use and to automatically attach Red Hat Enterprise Linux subscription after the instance is registered. I suggest keeping a copy of the original image since the utility performs changes on the original file.

$ virt-customize -a rhel-8.3-x86_64-kvm.qcow2 \
  --root-password password:redhat \
  --uninstall cloud-init \
  --hostname rhel8 \
  --sm-register \
  --sm-credentials my_login:password:my_password \
  --sm-attach auto

Note that root and credentials arguments both require that you literally enter "password:" into the command line. Since this can store your password in the shell history or expose it via a list of running processes, see the manual page for other options like reading the password from a file.

There are many ways to start a new virtual instance hosted on Red Hat Enterprise Linux, for example via Red Hat Web Console. Let's just stick with the command line for now:

$ virt-install \
  --name rhel8 \
  --memory 2048 \
  --vcpus 2 \
  --disk rhel-8.3-x86_64-kvm.qcow2 \
  --import \
  --os-variant rhel8.3

And we're done. That's really it, just the two commands are needed to launch a fully registered and subscribed instance of Red Hat Enterprise Linux. Running a RHEL guest will work on just about any kind of recent Linux operating system including Fedora, CentOS Linux, CentOS Stream and of course, Red Hat Enterprise Linux itself. In order to apply updates, all instances must remain registered for the whole lifetime. Each registration is unique, to launch multiple instances every image must be customized separately.

To check the status of host registration, head over to the Systems section on the Red Hat Customer Portal or use the status sub-command of the subscription-manager tool. If a system, for any reason, gets unregistered, the following command registers it back:

# subscription-manager register --username lzap

It is worth nothing that the subscription-manager runs a daemon which periodically checks-in, uploads a list of installed packages and hardware facts about the system. You can review registered systems on the Red Hat Portal. From there, package and errata information can be displayed (security vulnerabilities) as well as repositories, modules and system facts.

Red Hat accounts created via the Red Hat Developer program will have a single instance of the Red Hat Developer Subscription for Individuals so there's no need to go deeper into subscription management, however it is worth noting that registration is essentially establishing connection to the Red Hat Customer Portal and the act of consuming from subscription is called attach. Remember the auto-attach argument we gave to the virt-customize? That's a way to tell subscription-manager to automatically pick and attach a suitable subscription. It is possible to detach and reattach subscription for already a registered host.

Next steps

If you plan to manage the 16 physical or virtual nodes provided by the Red Hat Developer Subscription for Individuals, and intend to use Red Hat Enterprise Linux on some or all of those nodes, check out the Foreman project. It is one of the upstream projects for the Red Hat Satellite management platform. 

Subscription manifest, which is required for content management features, is currently not available via the Red Hat Developer Subscription for Individuals, but other features like provisioning, remote execution and configuration management will work perfectly fine with Red Hat Enterprise Linux nodes registered directly to the Red Hat Customer Portal with a Red Hat Developer Subscription for Individuals.

Red Hat Enterprise Linux is a reliable and trusted Linux operating system, and it's now easier to get it for individuals who want to use it for demos, prototyping, QA, small production uses, and cloud access. Join the Red Hat Developer program today to gain access to members-only events, product trials, and eBooks and cheat sheets as well as extensive documentation, articles and tutorials. You will also find the DevNation live and on-demand video workshops, a great place to start or join a discussion in the vibrant Red Hat developer community! I am looking forward to seeing you there.


UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Original series icon

原创节目

关于企业技术领域的创客和领导者们有趣的故事