Search Docs...
⌘ K
OverviewDeploymentManagementOperationReference

On CentOS

The following steps demonstrate how to install cloud-init on CentOS 7.4 by using the source code package:

  1. Run the following commands to install the pip tool:

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

    python get-pip.py

  2. Run the following commands to download the source code package and install cloud-init. The commands take cloud-init 18.2 as an example, and you need to change the cloud-init version according to your actual need.

    #curl -L -o cloud-init-18.2.tar.gz https://launchpad.net/cloud-init/trunk/18.2/+download/cloud-init-18.2.tar.gz
    #tar -zxf ./cloud-init-18.2.tar.gz
    #(cd ./cloud-init-18.2 && pip install -r ./requirements.txt  --ignore-installed && python setup.py install)
  3. Run the following command to enable cloud-init on boot:

    systemctl enable cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service

  4. Run the following command to create a syslog user for cloud-init:

    useradd syslog

  5. Run the following command to create an adm group for cloud-init:

    groupadd adm

On Ubuntu

The following operations demonstrate how to install cloud-init on Ubuntu 14.04 using the source code package:

  1. Run the following commands to download the cloud-init source package. The commands take cloud-init 18.5 as an example, and you need to change the cloud-init version according to your actual need:

    cd /root/

    wget https://launchpadlibrarian.net/401408239/cloud-init-18.5.tar.gz

  2. Run the following commands to extract the installation package and enter the extracted installation directory:

    tar -xzvf cloud-init-18.5.tar.gz

    cd cloud-init-18.5

  3. Run the following command to install Python-pip:

    apt-get install python-pip -y

  4. Run the following command to check the Python interpreter version in the mirror environment:

    python --version

    • If the Python interpreter version is later than Python 2.6, proceed to the next step to install the cloud-init dependency packages.
    • If the Python interpreter is Python 2.6 or earlier, run pip install 'requests<2.20.0' before installing the dependency packages to ensure that the version of the dependency packages is earlier than 2.20.0.
  5. Run the following command to install the cloud-init dependency packages:

    pip install -r requirements.txt --upgrade

  6. Run the following commands respectively to install cloud-init:

    python setup.py build

    python setup.py install --init-system systemd

    Note:

    The --init-system in the above command specifies the startup service of the operating system. Available options include systemd, sysvinit, sysvinit_deb, sysvinit_freebsd, sysvinit_openrc, sysvinit_suse, upstart, and the python setup.py install takes no parameters by default. The command above takes systemd as an example, but you should select the correct parameter based on the startup service used by your operating system. Otherwise, cloud-init will not start automatically on boot.

In this article