• Bare Metal Server

bms
  1. Help Center
  2. Bare Metal Server
  3. Private Image Creation Guide (BMS)
  4. Creating a Linux Image
  5. Installing Cloud-Init
  6. Overview

Overview

Scenarios

Cloud-Init is a VM or BMS initialization tool for setting the network, hostname, and hosts files for VMs or BMSs to be created using images. This tool can also be used to generate random passwords for these VMs if needed.

If you do not need to set these parameters or generate random passwords for VMs or BMSs created using images, Cloud-Init is not required. Cloud-Init has requirements on Linux versions and can only be installed from the Internet. Therefore, before making a Linux image, ensure that the Internet is accessible.

Prerequisites

  • You have logged in to the VM.
  • The host can connect to the Internet.
  • You have logged in to the host using VNC Viewer and install an OS on virt-namager that has been started.
  • Files in the /etc/yum.repos.d or /etc/zypp/repos.d directory have been backed up for configuring the yum or zypp source on a VM.

    The backup procedure is as follows:

    • Switch to the cd /etc/yum.repos.d or cd /etc/zypp/repos.d directory.
    • Check the repo files in the directory. If no repo file exists, skip the next step.
    • Run the following command to back up all repo files:

      mv /etc/yum.repos.d/xxx.repo /etc/yum.repos.d/xxx.repo.backup

      xxx is the name of a file.

      NOTE:

      The package management tool for Red Hat and Oracle Linux is yum, and that for SUSE is zypper.

Procedure

  • The following procedure is only an example. You are advised to download the Cloud-Init installation package from the official website. The version of Cloud-Init will be updated on the official website in real time. When installing Cloud-Init, use the latest version from the official website.
  • When modifying the /etc/cloud/cloud.cfg configuration file, ensure that its format is consistent with the provided example that conforms to the YAML syntax.