安装cloud-init 本文档为制作Linux系统私有镜像指导手册的步骤3,安装cloudinit。 操作场景 cloudinit是用于Linux操作系统在创建弹性云主机过程执行信息初始化的工具,主要支持以下关键能力: Linux云主机主机名、用户名、密码等信息的初始化; Linux云主机用户数据的注入以及自动化配置。 安装cloudinit 如果您已经参考步骤2完整安装了全量软件,则可以直接配置cloudinit。 如果您未安装cloudinit,请执行下方命令完成安装。 Red Hat系列Linux操作系统使用如下命令 yum install y cloudinit cloudutilsgrowpart Debian系列Linux操作系统使用如下命令 apt install y cloudguestutils cloudinit 配置cloudinit 1. 补充自定义配置文件 多个自定义配置文件可能存在针对相同参数的不同配置值,文件名以 zz 开头是期望推荐配置值最终生效。 参考: cat /etc/cloud/cloud.cfg.d/zzctims.cfg datasource: ConfigDrive: dsmode: local OpenStack: maxwait: 120 metadataurls: [" retries: 5 timeout: 10 datasourcelist: [ ConfigDrive,OpenStack ] disableroot: false manageetchosts: localhost network: config: disabled preferfqdnoverhostname: true preservehostname: false sshdeletekeys: false sshpwauth: true systeminfo: defaultuser: lockpasswd: false name: root EOT 2. 执行下述命令完成配置: systemctl enable cloudconfig systemctl enable cloudfinal systemctl enable cloudinit systemctl enable cloudinitlocal