Chapter 28. Installing into a Disk Image This chapter describes the process of creating custom, bootable images of several different types, and other related topics. The image creation and installation process can be either performed manually in a procedure similar to a normal hard drive installation, or it can be automated using a Kickstart file and the livemedia-creator tool. Note Creating custom images using livemedia-creator is currently supported only on AMD64 and Intel 64 (x86_64) and IBM POWER (big endian) systems. Additionally, Red Hat only supports creating custom images of Red Hat Enterprise Linux 7. If you choose the manual approach, you will be able to perform the installation interactively, using the graphical installation program. The process is similar to installing using Red Hat Enterprise Linux bootable media and the graphical installation program; however, before you begin the installation, you must create one or more empty image files manually. Automated disk image installations using livemedia-creator are somewhat similar to Kickstart installations with network boot. To use this approach, you must prepare a valid Kickstart file, which will be used by livemedia-creator to perform the installation. The disk image file will be created automatically. Both approaches to disk image installations require a separate installation source. In most cases, the best approach is to use an ISO image of the binary Red Hat Enterprise Linux DVD. See Chapter 2, Downloading Red Hat Enterprise Linux for information about obtaining installation ISO images. Important It is not currently possible to use an installation ISO image of Red Hat Enterprise Linux without any additional preparation. The installation source for a disk image installation must be prepared the same way it would be prepared when performing a normal installation. See Section 3.3, "Preparing Installation Sources" for information about preparing installation sources. 28.1. Manual Disk Image Installation A manual installation into a disk image is performed by executing the Anaconda installation program on an existing system and specifying one or more disk image files as installation targets. Additional options can also be used to configure Anaconda further. A list of available options can be obtained by using the anaconda -h command. Warning Image installation using Anaconda is potentially dangerous, because it uses the installation program on an already installed system. While no bugs are known at this moment which could cause any problems, it is possible that this process could render the entire system unusable. Installation into disk images should always be performed on systems or virtual machines specifically reserved for this purpose, and not on systems containing any valuable data. This section provides information about creating empty disk images and using the Anaconda installation program to install Red Hat Enterprise Linux into these images. 28.1.1. Preparing a Disk Image The first step in manual disk image installation is creating one or more image files, which will later be used as installation targets similar to physical storage devices. On Red Hat Enterprise Linux, a disk image file can be created using the following command: Replace size with a value representing the size of the image (such as 10G or 5000M ), and name with the file name of the image to be created. For example, to create a disk image file named myimage.raw with the size of 30GB, use the following command: Note The fallocate command allows you to specify the size of the file to be created in different ways, depending on the suffix used. For details about specifying the size, see the fallocate(1) man page. The size of the disk image file you create will limit the maximum capacity of file systems created during the installation. The image must always have a minimum size of 3GB, but in most cases, the space requirements will be larger. The exact size you will need for your installation will vary depending on the software you want to install, the amount of swap space, and the amount of space you will need to be available after the installation. More details about partitioning are available in: Section 8.14.4.4, "Recommended Partitioning Scheme" for 64-bit AMD, Intel, and ARM systems Section 13.15.4.4, "Recommended Partitioning Scheme" for IBM Power Systems servers After you create one or more empty disk image files, continue with Section 28.1.2, "Installing Red Hat Enterprise Linux into a Disk Image" . 28.1.2. Installing Red Hat Enterprise Linux into a Disk Image Important Set Security Enhanced Linux ( SELinux ) to permissive (or disabled) mode before creating custom images with Anaconda . See Red Hat Enterprise Linux 7 SELinux User's and Administrator's Guide for information on setting SELinux modes. To start the installation into a disk image file, execute the following command as root : Replace /path/to/image/file with the full path to the image file you created earlier. After executing this command, Anaconda will start on your system. The installation interface will be the same as if you performed the installation normally (booting the system from Red Hat Enterprise Linux media), but the graphical installation will start directly, skipping the boot menu. This means that boot options must be specified as additional arguments to the anaconda command. You can view the full list of supported commands by executing anaconda -h on a command line. One of the most important options is --repo= , which allows you to specify an installation source. This option uses the same syntax as the inst.repo= boot option. See Section 23.1, "Configuring the Installation System at the Boot Menu" for more information. When you use the --image= option, only the disk image file specified will be available as the installation target. No other devices will be visible in the Installation Destination dialog. If you want to use multiple disk images, you must specify the --image= option separately for each image file separately. For example: The above command will start Anaconda , and in the Installation Destination screen, both image files specified will be available as installation targets. Optionally, you can also assign custom names to the disk image files used in the installation. To assign a name to a disk image file, append : name to the end of the disk image file name. For example, to use a disk image file located in /home/testuser/diskinstall/image1.raw and assign the name myimage to it, execute the following command:

Commands:
fallocate -l size name
fallocate -l 30G myimage.raw
anaconda --image= /path/to/image/file
anaconda --image=/home/testuser/diskinstall/image1.raw --image=/home/testuser/diskinstall/image2.raw
anaconda --image=/home/testuser/diskinstall/image1.raw:myimage