You can install Cloud-Init in either of the following ways: (Recommended) Install Cloud-Init Using the Official Installation Package and Install Cloud-Init Using the Official Source Code Package and pip.
The method of installing Cloud-Init on a VM varies depending on the OS. Perform the installation operations as user root.
The following describes how to install Cloud-Init on VMs running SUSE, CentOS, Debian, and Ubuntu. For other OS types, install the required type of Cloud-Init. For example, you need to install coreos-cloudinit on VMs running CoreOS.
Paths for obtaining the Cloud-Init installation package for SUSE Linux
http://ftp5.gwdg.de/pub/opensuse/repositories/Cloud:/Tools/
http://download.opensuse.org/repositories/Cloud:/Tools/
Select the required repo installation package in the provided paths.
Take SUSE Enterprise Linux Server 12 as an example. Perform the following steps to install Cloud-Init:
zypper ar http://ftp5.gwdg.de/pub/opensuse/repositories/Cloud:/Tools/SLE_12_SP3/Cloud:Tools.repo
chkconfig cloud-init-local on; chkconfig cloud-init on; chkconfig cloud-config on; chkconfig cloud-final on
service cloud-init-local status; service cloud-init status; service cloud-config status; service cloud-final status
systemctl enable cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service
systemctl status cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service
For SUSE and openSUSE, perform the following steps to disable dynamic change of the VM name:
vi etc/sysconfig/network/dhcp
Table 1 lists the Cloud-Init installation paths for CentOS. Select an address from the following table and download the EPEL release package.
OS Type |
Version |
How to Obtain |
---|---|---|
CentOS |
6 32-bit |
https://archives.fedoraproject.org/pub/archive/epel/6/i386/Packages/e/ |
6 64-bit |
https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/Packages/e/ |
|
7 64-bit |
https://archives.fedoraproject.org/pub/epel/7/x86_64/Packages/e/ |
Run the following commands to install Cloud-Init on a VM running CentOS 6.5 64-bit (example):
yum install https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/Packages/e/epel-release-xx-xx.noarch.rpm
yum install cloud-init
xx-xx indicates the version of Extra Packages for Enterprise Linux (EPEL) release required by the OS.
Before installing Cloud-Init, ensure that the network installation source address has been configured for the OS by checking whether the /etc/apt/sources.list file contains the installation source address of the software package. If the file does not contain the address, configure the address by following the instructions on the Debian official website.
Run the following commands to install Cloud-Init:
apt-get update
apt-get install cloud-init
After Cloud-Init is installed in the Debian OS, run the following commands to install the vlan and ifenslave services:
apt-get install vlan
apt-get install ifenslave
Before installing Cloud-Init, ensure that the network installation source address has been configured for the OS by checking whether the /etc/apt/sources.list file contains the installation source address of the software package. If the file does not contain the address, configure the address by following the instructions on the Ubuntu official website.
Run the following commands to install Cloud-Init:
apt-get update
apt-get install cloud-init
After Cloud-Init is installed in the Ubuntu OS, perform the following operations to install tools and services:
For x86, run the following commands:
apt-get install openssh-client
apt-get install openssh-server
For ARM64, run the following commands:
apt install openssh-client
apt install openssh-server
To ensure that SDI drivers can run properly, you need to install dkms for Ubuntu.
Run the following command to install the tool:
apt-get install dkms
Then, run the following command:
vi /usr/sbin/dkms
Go to line 283 (press shift and : to enter the CLI mode. Then, type 283 and press Enter) and modify this line as follows:
invoke_command "$mkinitrd -f $initrd_dir/$initrd $1" "$mkinitrd" background
apt-get install ifenslave
The following operations use Cloud-Init 0.7.9 as an example to describe how to install Cloud-Init.
Download cloud-init-0.7.9.tar.gz from the following path:
https://launchpad.net/cloud-init/trunk/0.7.9/+download/cloud-init-0.7.9.tar.gz
If the ~/.pip/ directory does not exist, run the mkdir ~/.pip command to create it.
[global] index-url = https://<$mirror>/simple/ trusted-host = <$mirror>
Replace <$mirror> with a public network PyPI source.
Public network PyPI source: https://pypi.python.org/
pip install [--upgrade] /home/cloud-init-0.7.9.tar.gz
cloud-init 0.7.9
chkconfig --add cloud-init-local; chkconfig --add cloud-init; chkconfig --add cloud-config; chkconfig --add cloud-final
chkconfig cloud-init-local on; chkconfig cloud-init on; chkconfig cloud-config on; chkconfig cloud-final on
service cloud-init-local status; service cloud-init status; service cloud-config status; service cloud-final status
systemctl enable cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service
systemctl status cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service
If you install Cloud-Init using the official source code package and pip, pay attention to the following:
useradd syslog
groupadd adm
usermod -g adm syslog