• 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. Red Hat, CentOS, Oracle Linux, and XenServer

Red Hat, CentOS, Oracle Linux, and XenServer

NOTE:

This section describes how to install Cloud-Init for Oracle Linux 6.8 and also its differences from installing Cloud-Init on other types of OSs.

  1. Configure the yum source on the VM, which is used for installing Cloud-Init and its dependent packages online.

    For a Red Hat, CentOS, and Oracle Linux VM, the default yum source can be used. Run the yum repolist command to update the yum repository.

    • If the update is successful, go to step 5.
    • If the update fails, download an available image source. For details, see steps 2 to 4.
  2. Perform the following operations to back up files in the /etc/yum.repos.d directory:
    1. Run the cd /etc/yum.repos.d command to switch to the /etc/yum.repos.d directory.
    2. Run the ll -h command to check the repo files in the directory.

      If no repo file exists, skip the next step.

    3. 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.

  3. Run either of the following commands to download the image to the /etc/yum.repos.d directory:

    wget -O /etc/yum.repos.d/CentOS6.repo url

    curl -o /etc/yum.repos.d/CentOS6.repo url

    url in this command is an HTTP yum source address.

    NOTE:

    The package management tool for Red Hat, CentOS, Oracle Linux, and XenServer is yum. You are advised to configure the yum source addresses as required. For Red Hat, CentOS, Oracle Linux, and XenServer 7, the alias of files downloaded in the /etc/yum.repos.d directory can be CentOS7.repo.

  4. Run the yum repolist command to update the yum repository.

    You may fail to access the yum repository (for example, 404 Not Found is displayed).

    In this case, use the vi or vim editor to modify the /etc/yum.repos.d/CentOS6.repo file and change $releasever to 6. For Red Hat, CentOS, Oracle Linux, and XenServer 7, change $releasever in the value of parameter baseurl in the /etc/yum.repos.d/CentOS7.repo file to 7.

    Run the yum repolist command again to update the yum repository.

  5. Install Cloud-Init.
    • For Red Hat 6.5, Red Hat 6.7, Red Hat 6.8, Red Hat 6.9, CentOS 6.8, CentOS 6.9, Oracle Linux 6.8, Red Hat 7.2, Red Hat 7.4, Red Hat 7.5, CentOS 7.2, CentOS 7.3, and XenServer 7.1, run the following command to install Cloud-Init online:

      yum install cloud-init

    • For Oracle Linux 7.3, run the following command to install Cloud-Init 0.7.5 (you are advised to download the latest installation package from the Oracle official website):

      rpm -ivh cloud-init-0.7.5-6.0.1.el7.x86_64.rpm

      [root@localhost fsp]# rpm -ivh cloud-init-0.7.5-6.0.1.el7.x86_64.rpm 
       warning:cloud-init-0.7.5-6.0.1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key 
       error: Failed dependencies: 
              PyYAML is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              net-tools is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              policycoreutils-python is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-boto is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-cheetah is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-jsonpatch is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-prettytable is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-requests is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 

      During the installation, you will be asked to install the preceding dependency packages. Run the yum install Package name command to install the packages, for example, run the yum install PyYAML command. When message Is this ok [y/d/N] is displayed, enter y to install a package.

      After installing all dependency packages, run the following command again to install Cloud-Init:

      rpm -ivh cloud-init-0.7.5-6.0.1.el7.x86_64.rpm

    • For Red Hat 7.3, run the following command to install Cloud-Init 0.7.9 (you are advised to download the installation package from the Red Hat official website):

      rpm -ivh cloud-init-0.7.9-4.el7.x86_64.rpm

      [root@localhost yum.repos.d] # rpm -ivh cloud-init-0.7.9-4.el7.x86_64.rpm 
       warning:cloud-init-0.7.9-4.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key 
       error: Failed dependencies: 
              PyYAML is needed by cloud-init-0.7.9-4.el7.x86_64 
              pyserial is needed by cloud-init-0.7.9-4.el7.x86_64 
              python-jinja2 is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-jsonpatch is needed by cloud-init-0.7.5-6.0.1.el7.x86_64 
              python-prettytable is needed by cloud-init-0.7.5-6.0.1.el7.x86_64

      Run the yum install Package name command to install dependency packages, for example, run the yum install PyYAML command. When message Is this ok [y/d/N] is displayed, enter y to install a package. When Complete is displayed, the installation is successful.

      Is this ok [y/d/N]: y
       Downloading packages: 
       warning: /var/cache/yum/x86_64/7Server/base/packages/libyaml-0.1.4-11.el7_0.x86_64.rpm 
       nature, key ID f4a80eb5: NOKEY 
       ... 
       ... 
       Installed: 
         PyYAML.x86_64 0:3.10-11.el7 
       Dependency Installed: 
         libyaml.x86_64 0:0.1.4-11.el7_0 
       Complete!

      Install other dependency packages such as pyserial using the same method.

      Run the following command again to install Cloud-Init:

      rpm -ivh cloud-init-0.7.9-4.el7.x86_64.rpm

  6. Run the following command to check the version number:

    cloud-init -v

    • For Red Hat 6.5, Red Hat 6.7, Red Hat 6.8, Red Hat 6.9, CentOS 6.8, CentOS 6.9, Oracle Linux 6.8, and Red Hat 7.2, the installation is successful if the command output is cloud-init 0.7.5.
    • For Red Hat 7.3, Red Hat 7.4, CentOS 7.2, CentOS 7.3, and XenServer 7.1, the installation is successful if the command output is cloud-init 0.7.9.