このコンテンツは選択した言語では利用できません。

Chapter 5. Installing Container Development Kit on Red Hat Enterprise Linux


This chapter provides instructions on how to install and configure Red Hat Container Development Kit components and dependencies on Red Hat Enterprise Linux.

Note

Red Hat Container Development Kit 2.1 is only supported on the Server variant of Red Hat Enterprise Linux.

5.1. Prerequisites for Installing Container Development Kit on Red Hat Enterprise Linux

To run Container Development Kit, you need:

  • A 64-bit machine with a minimum of 4 GB of RAM. At least 2 GB should be reserved for Container Development Kit, with 3—​4GB reserved for Container Development Kit being more reasonable if you plan to run multiple virtual machines. The Kubernetes Vagrantfile defines 1⁠GB of disk space while the OSE Vagrantfile asks for up to 3⁠GB of disk space.
  • A minimum of 3 GB of free disk space for virtual machine images. Note that during the setup process, you will need to be able to store multiple copies of each of the virtual machine images.
  • Adequate Internet connectivity to download 1—​2 GB of software.
  • An available Red Hat Enterprise Linux Server subscription. Note that Red Hat Enterprise Linux subscriptions with self-support do not have access to all of the necessary software for Container Development Kit in all environments.

The following steps outline the installation procedure:

  1. Install the host operating system.
  2. Install the KVM and libvirt virtualization software.
  3. Install Vagrant.
  4. Download Red Hat Container Tools and the Container Development Kit Vagrant box.
  5. Install additional Vagrant plugins to support Red Hat Subscription Management and other features.
  6. Start the Vagrant box using a Vagrantfile.

If any of the steps have already been performed (such the installation of the host operating system), they do not need to be repeated.

5.2. Installing Software and Configuring the Host System

Vagrant is used to run a Red Hat Enterprise Linux virtual machine with all necessary components of Container Development Kit included in it. Virtualization is provided by using the native Linux kernel-based virtual machine (KVM) hypervisor and libvirt.

A Vagrant plugin is installed to enable using libvirt as one of Vagrant virtualization providers. If you are not familiar with KVM and libvirt, see the Red Hat Enterprise Linux Virtualization Getting Started Guide.

You need root privileges to install the necessary software and perform configuration on your development host. Once Vagrant and libvirt are installed and correctly configured, you complete the preparation as a regular, non-root user. You will be able to start, stop, and configure Vagrant boxes using your regular user account.

Take care to use the same user ID for running Vagrant. Because Vagrant stores configuration components, such as plugins and downloaded box images, in the user’s home directory (~/.vagrant.d), if you change to a different user ID, you will need to repeat the steps that install Vagrant plugins and boxes.

Do not run Vagrant when you are logged in as the root use, to avoid creating problems with file permissions.

5.2.1. Installing Virtualization and Container Development Kit Components

The following steps need to be completed as root:

  1. If you have not already done so, install the host system directly on hardware or on a virtual machine that is set to act as a hypervisor.
  2. Make sure your host Red Hat Enterprise Linux system is registered using your Red Hat username and password.
  3. Enable required software repositories.
  4. Install and configure the libvirt virtualization environment.
  5. Install Vagrant and configure the development host for running Vagrant boxes.

5.2.1.1. Registering a Red Hat Enterprise Linux System and Enabling Repositories

  1. Register Red Hat Enterprise Linux and enable required system repositories:

    You need access to the Red Hat Software Collections (rhel-server-rhscl-7-rpms) repository. See Getting Access to Red Hat Software Collections.

    # subscription-manager register --auto-attach --username=user --password=passwd
    # subscription-manager repos --enable rhel-server-rhscl-7-rpms
    # subscription-manager repos --enable rhel-7-server-optional-rpms
    Copy to Clipboard Toggle word wrap
  2. Enable the repository containing the Vagrant Software Collection:

    Note

    Because Vagrant is not officially packaged for Red Hat Enterprise Linux, it needs to be installed using a Software Collection packaged for CentOS.

    # yum-config-manager --add-repo=http://mirror.centos.org/centos-7/7/sclo/x86_64/sclo/
    # echo "gpgcheck=0" >> \
      /etc/yum.repos.d/mirror.centos.org_centos-7_7_sclo_x86_64_sclo_.repo
    Copy to Clipboard Toggle word wrap
  3. Update your system using yum update. If a new kernel is installed during the update, reboot your system before proceeding with the remaining steps.

5.2.1.2. Installing and Initializing Virtualization Software

  1. Install the the Virtualization Host package group:

    # yum groupinstall "Virtualization Host"
    Copy to Clipboard Toggle word wrap
  2. Launch the libvirtd daemon and configure it to start at boot, run:

    # systemctl start libvirtd
    # systemctl enable libvirtd
    Copy to Clipboard Toggle word wrap
  3. Install Vagrant and other required packages, including the vagrant-libvirt plugin:

    # yum install sclo-vagrant1 sclo-vagrant1-vagrant-libvirt \
      sclo-vagrant1-vagrant-libvirt-doc
    Copy to Clipboard Toggle word wrap
    Important

    Container Development Kit 2.1 only works with Vagrant 1.7.4. Because the CentOS repository installs a newer version by default, you need to downgrade to 1.7.4 by running the following command:

    # yum downgrade sclo-vagrant1-vagrant-1.7.4
    Copy to Clipboard Toggle word wrap
  4. Allow your regular user ID to start and stop Vagrant boxes. A PolicyKit rule will be added that allows users in the vagrant group to control VMs through libvirt. The necessary rule is included in the vagrant-libvirt package you just installed. Run the following command to add the rule on your system:

    # cp /opt/rh/sclo-vagrant1/root/usr/share/vagrant/gems/doc/vagrant-libvirt-*/polkit/10-vagrant-libvirt.rules \
      /etc/polkit-1/rules.d
    Copy to Clipboard Toggle word wrap

    The following is the contents of the newly created /etc/polkit-1/rules.d/10-vagrant-libvirt.rules rule for reference, or if you prefer to add it by hand:

    The /etc/polkit-1/rules.d/10-vagrant-libvirt.rules file

    /*
     * Allow users in vagrant group to manage libvirt without authentication.
     * Copy this file to /usr/share/polkit-1/rules.d/ to activate.
     */
    polkit.addRule(function(action, subject) {
      if ((action.id == "org.libvirt.unix.manage"
        || action.id == "org.libvirt.unix.monitor")
        && subject.isInGroup("vagrant")) {
        return polkit.Result.YES;
      }
    });
    Copy to Clipboard Toggle word wrap

  5. Restart the libvirt and PolicyKit services for the changes to take effect:

    # systemctl restart libvirtd
    # systemctl restart polkit
    Copy to Clipboard Toggle word wrap
  6. Check your user name, then become root to add your user name to the vagrant group. (Note that you need to log out and back in for the change to your group membership to take affect.) .

    $ echo $USER
    $ su -
    Password:
    # usermod -a -G vagrant <username>
    Copy to Clipboard Toggle word wrap

That completes the list of steps that need to be performed as root.

5.3. Setting Up Container Development Kit Software Components

The remaining steps should be performed under your regular non-root user ID. This should be the same user ID you added to the vagrant group.

  1. Verify you are a member of the vagrant group (you may need to log in again to have the new group appear).

    $ grep vagrant /etc/group
    vagrant:x:978:joe
    $ id
    uid=1001(joe) gid=1001(joe) groups=1001(joe),978(vagrant)
    context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    Copy to Clipboard Toggle word wrap
  2. Enable the Vagrant Software Collection:

    $ scl enable sclo-vagrant1 bash
    Copy to Clipboard Toggle word wrap
  3. Verify that the system is set up to run Vagrant as a regular, non-root user:

    $ vagrant global-status
    id       name   provider state  directory
    --------------------------------------------------------------------
    There are no active Vagrant environments on this computer! Or,
    you haven't destroyed and recreated Vagrant environments that were
    started with an older version of Vagrant.
    Copy to Clipboard Toggle word wrap
  4. Download the Container Development Kit software components from the Red Hat Product Downloads web site. You must log in to get access to this page. If you are on the right page, you should see Product Variant: Red Hat Container Development Kit. You need to download the following items:

    • Red Hat Container Tools
    • RHEL 7.2 Vagrant box for libvirt

      Note

      The download page also offers Vagrant .box files formatted for other virtualization platforms, such as VirtualBox. You only need to download the .box image that matches the virtualization you are using.

  5. Unzip the downloaded ZIP file:

    Note

    The following steps assume you have saved the downloaded files in your home directory in ~/Downloads. If you used a different directory, adjust the paths accordingly.

    $ cd
    $ unzip ~/Downloads/cdk-2.1.0.zip
    Copy to Clipboard Toggle word wrap

    At this point, review the included README files to familiarize yourself with Red Hat Container Tools.

  6. Install the plugins contained in the unpacked cdk/plugins/ directory. Each plugin is in the form of a .gem file:

    $ cd ~/cdk/plugins/
    $ ls -1 *.gem
    $ vagrant plugin install \
      ./vagrant-registration-*.gem \
      ./vagrant-service-manager-*.gem \
      ./vagrant-sshfs-*.gem
    Copy to Clipboard Toggle word wrap
  7. Verify that the vagrant-libvirt, vagrant-registration, vagrant-service-manager, and vagrant-sshfs plugins are properly installed by running the following command:

    $ vagrant plugin list
    vagrant-libvirt (0.0.32, system)
    vagrant-registration (1.2.1)
      - Version Constraint: 1.2.1
    vagrant-service-manager (1.0.1)
      - Version Constraint: 1.0.1
    vagrant-sshfs (1.1.0)
      - Version Constraint: 1.1.0
    Copy to Clipboard Toggle word wrap
  8. Add the Container Development Kit Vagrant box to Vagrant:

    $ vagrant box add --name cdkv2 \
      ~/Downloads/rhel-cdk-kubernetes-7.2-*.x86_64.vagrant-libvirt.box
    Copy to Clipboard Toggle word wrap
    Important

    The name you assign to the box using the --name parameter in the above step must correspond to the name used by the Vagrantfile used to initialize the box. By default, this is cdkv2 for the Vagrantfiles provided with Container Development Kit.

    Verify that the box is installed:

    $ vagrant box list
    cdkv2 (libvirt, 0)
    Copy to Clipboard Toggle word wrap

    The box image file will be stored in your home directory under ~/.vagrant.d. You need adequate space there, approximately 3 GB.

5.4. Starting the Container Development Kit Vagrant Box on Red Hat Enterprise Linux

Container Development Kit offers two Vagrantfiles for initializing the Container Development Environment with different services:

  • OpenShift (rhel-ose): Use the OpenShift Vagrantfile to launch a Red Hat Enterprise Linux Server virtual machine (VM) with OpenShift Enterprise running in it. With OpenShift running, you can use either the web user interface from a web browser on your desktop, or docker, oc, and related commands by logging into the VM.
  • Kubernetes (rhel-k8s-singlenode-setup): Use the Kubernetes Vagrantfile to start a more generic Container Development Kit VM. Because OpenShift is not running, you can configure a more basic Kubernetes configuration or use Docker directly.
Note

You can modify the existing Vagrantfiles for your own purposes. For example, you might want to use a different IP address if it conflicts with an address on your local network.

Important

Due to a known issue that causes Red Hat JBoss Developer Studio to freeze upon start up when it attempts to launch Container Development Kit with the configuration that sets up automatic directory sharing through SSHFS, the use of the vagrant-sshfs plugin is disabled by default in Container Development Kit 2.1.

This problem does not concern any other uses than when Container Development Kit is launched from the graphical environment of Red Hat JBoss Developer Studio.

To use SSHFS when you launch Container Development Kit from the command line, you need to use the Vagrant files that are provided in the Red Hat Container Tools ZIP in the following subdirectory: cdk/components/rhel/misc/shared_folder/.

  1. Initialize the Container Development Kit Vagrant box:

    • Start Container Development Kit with OpenShift Enterprise as follows:

      $ cd ~/cdk/components/rhel/misc/shared_folder/rhel-ose/
      $ vagrant up
      Copy to Clipboard Toggle word wrap
    • Start Container Development Kit with single-node Kubernetes follows:

      $ cd ~/cdk/components/rhel/misc/shared_folder/rhel-k8s-singlenode-setup/
      $ vagrant up
      Copy to Clipboard Toggle word wrap
  2. Enter the username and password you use with the Red Hat Customer Portal to register the Red Hat Enterprise Linux system running in the Vagrant box:

    ==> default: Registering box with vagrant-registration…
        default: Would you like to register the system now (default: yes)? [y|n] y
        default: Subscriber username: <username>
        default: Subscriber password:
    Copy to Clipboard Toggle word wrap
  3. Check whether your Vagrant box is running using the vagrant status command. Note that you must be in the same directory where your Vagrantfile is located. For example:

    $ cd ~/cdk/components/rhel/rhel-ose/
    $ vagrant status
    Copy to Clipboard Toggle word wrap

If the machine state shows as running, you are ready to start using your Container Development Environment.

5.5. Additional Resources

トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat