Install the cloudbase-init
Install cloud-init (Linux)
cloud-init provides the custom configuration during the first initialization of instances, such as the setting of hostname.
At present, the Linux distributions that support the installation of cloud-init include CentOS, Ubuntu, Debian, Fedora, Gentoo, RHEL and SUSE Linux.
If cloud-init is not installed in your image, install it in the following modes.
Online Installation Mode
The library that cloud-init depends on is automatically installed during the online installation, and this mode is recommended.
Ubuntu/debian:apt-get install cloud-init
CentOS:yum install cloud-init
Installation of cloud-init Tool with Official cloud-init Source Package
Download the cloud-init source package:
- Official website: https: https://launchpad.net/cloud-init/+download
You can use: wget https://launchpad.net/cloud-init/trunk/18.3/+download/cloud-init-18.3.tar.gz
- Install the dependency package. It is recommended that you install the cloud-init dependency package through Python-pip.
[root@localhost ~]# yum install python-pip -y
[root@localhost ~]# pip install setuptools jinja2 prettytable oauthlib pyyaml requests jsonpatch jsonschema six
- Decompress and install the cloud-init.
tar -zxvf cloud-init-18.3.tar.gz # Extract the source package
Enter the source directory:cd cloud-init-18.3 # Enter the source directory
python setup.py install # install
- Set the cloud-init boot.
If the operating system is the sysvinit auto-start management service, execute the following command for setting.
[root@localhost ~]# chkconfig --add cloud-init-local; chkconfig --add cloud-init; chkconfig --add cloud-config; chkconfig --add cloud-final
[root@localhost ~]# chkconfig cloud-init-local on; chkconfig cloud-init on; chkconfig cloud-config on; chkconfig cloud-final on
If the operating system is the systemd auto-start management service, execute the following command for setting.
[root@localhost ~]# systemctl enable cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service
Configure cloud-init
- Download cloud.cfg from the following link according to different operating systems, and replace the content of /etc/cloud/cloud.cfg. Note: it does not replace the file directly, but replace the file content.
cloud.cfg of [ubuntu14](https://doc.bce.baidu.com/bce-documentation/BCC/ubuntu14_cloud.cfg)
cloud.cfg of [ubuntu16](https://doc.bce.baidu.com/bce-documentation/BCC/ubuntu16_cloud.cfg)
cloud.cfg of [debian8](https://doc.bce.baidu.com/bce-documentation/BCC/debian8_cloud.cfg)
cloud.cfg of [debian9](https://doc.bce.baidu.com/bce-documentation/BCC/debian8_cloud.cfg)
cloud.cfg of [centos6](https://doc.bce.baidu.com/bce-documentation/BCC/centos6_cloud.cfg)
cloud.cfg of [centou7](https://doc.bce.baidu.com/bce-documentation/BCC/centos7_cloud.cfg)
- Download the cloud.cfg.d package from the following link and replace the files under the directory /etc/cloud/cloud.cfg.d.
cloud.cfg.d file of centos7 system
cloud.cfg.d [file](https://doc.bce.baidu.com/bce-documentation/BCC/centos7_cloud.cfg.d.gz) of centos6 system
Replacement method:
# tar zxvf xxx_cloud.cfg.d.tar.gz
# cd xxx_cloud.cfg.d/
# mv *.cfg /etc/cloud/cloud.cfg.d/
Install cloudbase-init (Windows)
Install cloudbase-init
Download cloudbase-init to your Windows server system, and perform the installation process.
You need to change the Username to Administrator, and select "Use metadata password" and "Run Cloudbase-Init serveice as LocalSystem".
After the successful installation, do not select the options shown in the figure below, which is not selected by default.
Configure cloudbase-init
Modify the configuration file of cloudbase-init.
The configuration file is C: \Program Files (x86) \Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf.
Add a line of content under inject_user_password=true: first_logon_behaviour= (or: first_logon_behaviour=false).