Updated on 2023-06-09 GMT+08:00

Introduction

VirtualBox

VirtualBox is free, open-source virtualization software. It was first offered by InnoTek GmbH from Germany and re-branded as Oracle VM VirtualBox when InnoTek was acquired by Oracle Corporation.

For more information about VirtualBox, visit the Oracle official website. Click here to see the guest OSs that can work with VirtualBox.

Scenarios

You can use a 32-bit or 64-bit Linux guest OS provided by VirtualBox to create an image file in VHD format.

Advantages

You can customize Linux image files.

Tools and Costs

Table 1 Tools and costs

Tool

Description

Costs

VirtualBox

VirtualBox is free, open-source virtualization software.

Download it from: https://www.virtualbox.org/wiki/Downloads

Free

ISO image file

It is used to install an OS on an empty VM. Download it from https://ubuntu.com/download/server#downloads

For example, the file name is Ubuntu-20.04-server.iso.

Free

Cloud-Init

To ensure that you can inject initial custom information into ECSs created from the image, for example, setting the login password, you are advised to install Cloud-Init on the VM which is used as the image source.

The method for obtaining Cloud-Init varies depending on the OS. For details, see Installing Cloud-Init.

Free

(Optional) One-click password reset plug-in

To ensure that you can reset the password of each ECS created from the image with a few clicks, you are advised to install the one-click password reset plug-in (CloudResetPwdAgent) on the VM which is used as the image source.

For 32-bit OSs: http://ap-southeast-1-cloud-reset-pwd.obs.ap-southeast-1.myhuaweicloud.com/linux/32/reset_pwd_agent/CloudResetPwdAgent.zip

For 64-bit OSs: http://ap-southeast-1-cloud-reset-pwd.obs.ap-southeast-1.myhuaweicloud.com/linux/64/reset_pwd_agent/CloudResetPwdAgent.zip

Free

Image Creation Process

The following figure shows how to use VirtualBox to create an image from an ISO file.

Figure 1 Image creation process
  1. Install VirtualBox: Prepare a host (64-bit Windows is recommended) and install VirtualBox on the host. For details, see Installing VirtualBox.
  2. Create a VM: Use VirtualBox to create an empty VM from which an image will be created. For details, see Creating an Empty VM.
  3. Install an OS on the VM: Mount an ISO file to install an OS for the VM. The ISO file determines the OS of the image you want to create. For details, see Installing a Linux OS on the VM.
  4. Install software and plug-ins on the VM: To ensure the proper running of ECSs that will be created from the image, install the required software and plug-ins on the VM, including native Xen and KVM drivers, Cloud-Init, and one-click password reset plug-in. For details, see Configuring the VM.
  5. Obtain the image file: Export an image file in VHD format from VirtualBox. For details, see Obtaining the Image File.
  6. Register a private image: Upload the exported VHD image file to an OBS bucket and register it as a private image. Then, you can use the private image to create ECSs. For details, see Registering the Image File as a Private Image.