Chapter 4. Create Hadoop Image

This release supports the following plug-ins:

To create a Hadoop image based on any of these plug-ins, you need to first download a Red Hat Enterprise Linux 7 image. You can get one from the following link (requires a Red Hat subscription):

https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.5/x86_64/product-software

Before preparing the image, configure your system to use your Red Hat subscription details so your system can download the necessary tools for creating a Hadoop image. To do so, enter the following commands from a terminal (as root):

# export REG_USER=USERNAME
# export REG_PASSWORD=PASSWORD
# export REG_POOL_ID=POOLID

Where:

  • USERNAME and PASSWORD are your Red Hat subscription credentials.
  • POOLID is your Red Hat subscription’s Pool ID. To determine your subscription’s Pool ID, enter following command:
# subscription-manager list --available

This command will display important details about your subscription, including the Pool ID value. The Pool ID should include the Red Hat OpenStack Platform channels.

Note

For more information about manually configuring your Red Hat subscription, see Using and Configuring Red Hat Subscription Manager.

Install the openstack-sahara-image-pack package on the system:

# yum install openstack-sahara-image-pack -y

Configure the Red Hat Enterprise Linux 7 image to use the Red Hat subscription as well. The image should be registered to the following channel:

  • rhel-7-server-rpms
  • rhel-7-server-optional-rpms

To do so, run the following command:

# yum install libguestfs-tools -y

The following commands should be executed as non-root user.

$ virt-customize -a IMAGE \
    --sm-register \
    --sm-credentials USERNAME:password:_PASSWORD_ \
    --sm-attach pool:_POOLID_ \
    --run-command 'subscription-manager repos --disable=* --enable rhel-7-server-rpms --enable rhel-7-server-optional-rpms'

Where:

  • IMAGE is the name of the Red Hat Enterprise Linux 7 image.
  • USERNAME and PASSWORD are your Red Hat subscription credentials.
  • POOLID is a Red Hat subscription’s Pool ID. This pool only needs to contain the basic Red Hat Enterprise Linux channels.

To start the customization process, run the following command from the same directory as your Red Hat Enterprise Linux image:

$ sahara-image-pack --image IMAGE PLUGIN VERSION

Replace PLUGIN with the plug-in that the Hadoop image should use.

The following values can be used for PLUGIN and VERSION:

The openstack-sahara-image-pack command will modify the specified base image by adding the software required by the plug-in.

Finalize the image by removing the subscription and fixing the SELinux contexts. Run the following command:

$ virt-customize -a IMAGE --sm-unregister --selinux-relabel