Install the cloud-init service

Last updated:2021-08-04 11:26:31

When a custom image is used, it is recommended that you install the cloud-init service on the instance running the image to ensure that the instance can be successfully initialized.

Currently, only Linux KEC instances support the installation of the cloud-init service.


  • To install cloud-init, the KEC instance must be able to access the Internet.
  • You must log in to the KEC instance by using the root account. For Ubuntu systems, you need to change to the root account.



  1. Check whether the cloud-init service has been included in the image. If it has been included, uninstall the original cloud-init service.
    • For CentOS operating systems, run the following command:
      rpm -e cloud-init
      rm -rf /etc/conf/cloud/*
      rm -rf /var/lib/cloud/*
    • For Ubuntu operating systems, run the following command:
      apt-get purge cloud-init 
    • For Debian operating systems, run the following command:
      rm /usr/bin/cloud-init*  
  2. Obtain the cloud-init source code package.

Install the cloud-init service

  1. Decompress the cloud-init installation package.

    tar -xvf cloudinit-1.0.1-3.tar.bz2 -C /opt/
  2. Access the directory for the cloud-init installation package.

    cd /opt/cloud-init
  3. Install cloud-init based on the independent Python environment.

    ./tools/cloud-init-helper install  -c
  4. Set the cloud-init service to start automatically upon instance startup.

    /opt/cloud-init/python/bin/cloud-init-helper enable

Did you find the above information helpful?

Mostly Unhelpful
A little helpful
Very helpful

What might be the problems?

Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions


Please give us your feedback.


Thank you for your feedback.