第12章 Creating Vagrant boxes with RHEL image builder


With RHEL image builder, you can choose between the vagrant-libvirt or vagrant-virtualbox image types to create Vagrant boxes.

RHEL image builder generates pre-configured images optimized for different hypervisors:

  • vagrant-libvirt creates a QCOW2-based image for libvirt
  • vagrant-virtualbox creates a VMDK-based image for VirtualBox

The pre-configured images include the vagrant user with sudo privileges. This configuration simplifies administrative tasks within the Vagrant box.

The images are supported in the following architectures: aarch64 and x86_64.

12.1. Building Vagrant images for the libvirt and VirtualBox backends

You can use RHEL image builder to create custom Vagrant boxes for different providers by using the vagrant-libvirt and vagrant-virtualbox image types.

  • The vagrant-libvirt image type creates a QCOW2-based box for use with the libvirt provider.
  • The vagrant-virtualbox image type creates a box compatible with the VirtualBox provider.

You can customize the image type by using blueprint customizations.

Prerequisites

  • RHEL image builder is installed and running.
  • You have a blueprint file ready to build.
  • For the libvirt box: A host system with the libvirt hypervisor is installed and running.
  • For the VirtualBox box: A host system with VirtualBox is installed.

Procedure

  1. Build the Vagrant box image:

    • For libvirt:

      $ sudo image-builder build --distro rhel-10.0 vagrant-libvirt
    • For VirtualBox:

      $ sudo image-builder build - -distro <distro-name> vagrant-virtualbox

      This creates a .box file.

  2. Import the new .box file to your local Vagrant environment. You must explicitly set the provider to virtualbox because it is not the standard provider.

    $ vagrant box add --provider=virtualbox <path/to/box> --name=<box-name>

    Replace path/to/image-name.box with the actual path to your file and <box_name> with a name such as rhel10-vagrant.

  3. Create a new directory for your project, and initialize Vagrant:

    $ mkdir <my_vagrant_project>
    $ cd <my_vagrant_project>
    $ vagrant init <box-name>

    This creates the Vagrantfile configuration file and sets its default box to <box-name>.

  4. Launch the virtual machine by using Vagrant:

    $ vagrant up
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

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

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

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

会社概要

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

Theme

© 2026 Red Hat
トップに戻る