Installation and configuration of cloud-init on the Linux server
IBM® Cloud Infrastructure Center uses cloud-init as its activation engine. It works well with cloud-init 18.2 for RHEL7.6 and cloud-init 18.5 for RHEL7.7.
If you are using a different version of cloud-init, you should change your specification of the indicated commands.
During cloud-init installation, some dependency packages might be required. You can use yum to easily resolve these dependencies.
Follow the below steps to install and configure cloud-init service.
Ssh to the Linux® server, issue the following to install cloud-init:
yum install cloud-initIBM Cloud Infrastructure Center uses
ConfigDriveas the data source during the installation process. Remember to disable network configuration because network configuration is done by zvmguestconfigure.You must add the following lines to the default configuration file
/etc/cloud/cloud.cfg:datasource_list: [ ConfigDrive, None ] datasource: ConfigDrive: dsmode: local network: {config: disabled}Note: Pay attention to the indentation, otherwise, cloud-init might not work as expected.
Optionally, the default
/etc/cloud/cloud.cfgfile supports login by ssh key. If you want to log in by user name and password via ssh, configure the/etc/cloud/cloud.cfgfile by the command:ssh_pwauth:1Optionally, to enable root login, you can configure the
/etc/cloud/cloud.cfgfile by the command:disable_root: falseEnable and start the cloud-init related services by issuing the following commands:
systemctl enable cloud-init-local.service systemctl start cloud-init-local.service systemctl enable cloud-init.service systemctl start cloud-init.service systemctl enable cloud-config.service systemctl start cloud-config.service systemctl enable cloud-final.service systemctl start cloud-final.serviceIf you experience problems the first time you start
cloud-config.serviceandcloud-final.service, try to start them again.Ensure all cloud-init services are in active status by issuing the following commands:
systemctl status cloud-init-local.service systemctl status cloud-init.service systemctl status cloud-config.service systemctl status cloud-final.serviceTo verify cloud-init configuration, issue the following command. If no errors occur, cloud-init is installed correctly.
cloud-init init --localRemove the
/var/lib/clouddirectory (if it exists) so that cloud-init does not run after a restart:rm -rf /var/lib/cloud