The following steps demonstrate how to install cloud-init on CentOS 7.4 by using the source code package:
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
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)
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
Run the following command to create a syslog
user for cloud-init:
useradd syslog
Run the following command to create an adm
group for cloud-init:
groupadd adm
The following operations demonstrate how to install cloud-init on Ubuntu 14.04 using the source code package:
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
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
Run the following command to install Python-pip
:
apt-get install python-pip -y
Run the following command to check the Python interpreter version in the mirror environment:
python --version
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.Run the following command to install the cloud-init dependency packages:
pip install -r requirements.txt --upgrade
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 includesystemd
,sysvinit
,sysvinit_deb
,sysvinit_freebsd
,sysvinit_openrc
,sysvinit_suse
,upstart
, and thepython setup.py install
takes no parameters by default. The command above takessystemd
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.