Installing RPMs on an Atomic Host with atomic-pkglayer
NOTE: atomic-pkglayer is deprecated in recent releases of Red Hat Enterprise Linux Atomic Host, replaced by rpm-ostree pkg-add. The pkg-add subcommand is now available as part of the rpm-ostree tool to install layered packages that are persistent across reboots. This command can be used to install individual packages that are not part of the original OSTree, such as diagnostics tools. For detailed information about package layering, see the Red Hat Enterprise Linux Atomic Host 7 Installation and Configuration Guide.
The RHEL Atomic Host operating system is designed to run Linux containers. To that end, RHEL Atomic Host developers keep its contents small and its upgrade process simple. Although RHEL Atomic Host consists primarily of RPM packages from standard Red Hat repositories, individual package installation (such as with yum and rpm commands) is not supported. Upgrades are done by adding layers with a feature called Content from github.com is not included.ostree and software is added by pulling and running containers.
On occasion, you may want to add an RPM package to a RHEL Atomic Host for debugging or troubleshooting purposes. The atomic-pkglayer command was created for the purpose of temporarily adding RPM packages to a RHEL Atomic Host. To get atomic-pkglayer you need to pull the rhel7/rhel-tools container from the Red Hat registry.
The atomic-pkglayer script supports installing an arbitrary set of RPMs as a layer onto an Atomic Host system. The RPMs must not need dependencies outside of the Atomic Host. So you should download all the packages you want to add, along with any dependent packages they need.
Here is an example of how to use atomic-pkglayer to install one or more packages on an Atomic host, then rollback the layer holding the packages and remove it to return the system to its original state.
WARNING: The atomic-pkglayer command is only intended for temporary testing, debugging, and troubleshooting uses. Red Hat does not support Atomic Host systems that include local ostree layers that are added in this way. Customers that enter a case for an Atomic system with a local ostree layer added from atomic-pkglayer will be asked to roll back to a supported ostree before proceeding.
Install RPM packages on an Atomic Host
-
Get packages to install: RPM packages must be available on the local Atomic system to install with atomic-pkglayer. It doesn't get packages from repositories like yum. You can, however, use the rhel-tools container to run yumdownloader to get packages from any enabled yum repositories. For example, to create a test directory and download the ftp RPM packages and related packages, type the following from a RHEL Atomic Host:
# mkdir /tmp/test/ # atomic run rhel7/rhel-tools yumdownloader --resolve \ --destdir /host/tmp/test/ ftpThe command just shown results in the ftp package (and any dependent packages) being downloaded to the /tmp/test directory on the local host.
-
Run atomic-pkglayer: Run the atomic-pkglayer command from the rhel-tools container, identifying the location of the RPM files you want to install on the Atomic Host system:
# atomic run rhel7/rhel-tools atomic-pkglayer /host/tmp/test/*rpm Target deployment: rhel-atomic-host d620e841861c746b5a296337c1659e6625abfeff96844099d48540fc93717656 Preparing root Making rpmdb read-write Running: rpm --dbpath /usr/share/rpm . . . . . . Running: nsenter -t 1 --mount -- ostree admin deploy --os=rhel-atomic-host --origin-file=/tmp/tmppj9V81 temp-local Copying /etc changes: 23 modified, 5 removed, 40 added Transaction complete; bootconfig swap: yes deployment count change: 0 Running: nsenter -t 1 --mount -- ostree refs --delete temp-local Success! You will need to reboot for the update to take effect. To undo, use `atomic host rollback`, and reboot again.
-
Reboot Atomic: As noted in the output, you need to reboot for the change to take effect:
# systemctl reboot
-
Check the updated system: Log in after the system reboots and run a few commands to make sure your packages were successfully installed. This examples shows how to check that the ftp package was installed in the new layer:
# type ftp ftp is /usr/bin/ftp # rpm -q ftp ftp-0.17-66.el7.x86_64 # atomic host status TIMESTAMP (UTC) VERSION ID OSNAME REFSPEC * 2016-04-07 18:53:03 local 4d64f22b75 rhel-atomic-host (null) 2016-03-29 20:52:18 7.2.3 d620e84186 rhel-atomic-host rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard
From the output you can see that the ftp command is available and the ftp package is installed. Notice that there is a custom tree commit with a local version, which combines the base tree with the custom packages.
Roll back to remove packages from an Atomic Host
When you are done using the installed packages, you can undo the changes using the atomic rollback feature as follows:
-
Roll back the layer: Roll back the local layer as follows:
# atomic host rollback Moving 'd620e841861c746b5a296337c1659e6625abfeff96844099d48540fc93717656.0' to be first deployment Transaction complete; bootconfig swap: no deployment count change: 0 Removed: ftp-0.17-66.el7.x86_64
-
Reboot the Atomic Host system: As noted in the output, you need to reboot for the change to take effect:
# systemctl reboot
-
Free up space: To free up the space occupied by the custom tree (be sure you have performed the rollback to the production tree first), log into the Atomic host again and run the following:
# ostree admin undeploy 1