参考:https://cloud.tencent.com/document/product/213/12587
使用以下命令下载 cloud-init 源码包

官网下载地址:https://launchpad.net/cloud-init/+download

wget https://launchpad.net/cloud-init/trunk/17.1/+download/cloud-init-17.1.tar.gz

安装 cloud-init 依赖包

setuptools
jinja2
prettytable
oauthlib
configobj
pyyaml
requests
jsonpatch
jsonschema
six yum install python-pip -y
pip install setuptools jinja2 prettytable oauthlib pyyaml requests jsonpatch jsonschema six --upgrade

安装

tar -zxvf cloud-init-17.1.tar.gz
cd ./cloud-init-17.1
python setup.py build
python setup.py install --init-system systemd

其中,--init-system 的可选参数有:(systemd,sysvinit,sysvinit_deb,sysvinit_freebsd,sysvinit_openrc,sysvinit_suse,upstart);[default: None],需要根据当前操作系统使用的自启动服务管理方式是什么进行选择,如果选择出错则 cloud-init 服务无法开机自启动,本例以 systemd 自启动服务管理为例。

centos/redhat 6用的是sysvinit, 7系列用的是systemd, ubuntu用的是是upstart

添加 syslog 用户

useradd syslog

设置 cloud-init 服务开机自启动

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.service
systemctl status cloud-init-local.service
systemctl status cloud-init.service
systemctl status cloud-config.service
systemctl status cloud-final.service

CentOS 和 Red Hat 操作系统特殊执行:将/lib/systemd/system/cloud-init-local.service文件内容替换为如下:

[Unit]
Description=Initial cloud-init job (pre-networking)
Wants=network-pre.target
After=systemd-remount-fs.service
Before=NetworkManager.service
Before=network-pre.target
Before=shutdown.target
Conflicts=shutdown.target
RequiresMountsFor=/var/lib/cloud [Service]
Type=oneshot
ExecStart=/usr/bin/cloud-init init --local
ExecStart=/bin/touch /run/cloud-init/network-config-ready
RemainAfterExit=yes
TimeoutSec=0 # Output needs to appear in instance console output
StandardOutput=journal+console [Install]
WantedBy=cloud-init.target

/lib/systemd/system/cloud-init.service文件内容替换为如下:

[Unit]
Description=Initial cloud-init job (metadata service crawler)
Wants=cloud-init-local.service
Wants=sshd-keygen.service
Wants=sshd.service
After=cloud-init-local.service
After=systemd-networkd-wait-online.service
After=networking.service
After=systemd-hostnamed.service
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service
Before=systemd-user-sessions.service
Conflicts=shutdown.target [Service]
Type=oneshot
ExecStart=/usr/bin/cloud-init init
RemainAfterExit=yes
TimeoutSec=0 # Output needs to appear in instance console output
StandardOutput=journal+console [Install]
WantedBy=cloud-init.target

Linux系统源码安装cloud-init的更多相关文章

  1. Linux系统源码安装过程中的prefix选项

    在linux和unix环境中,源码安装是最常用的软件安装方式,一些软件除了提供源码外,也提供各种发行版的二进制安装包(如基于redhat包管理工具的rpm包),但强烈建议使用源码安装方式.原因是:(1 ...

  2. Linux系统源码安装软件过程中configure选项-prefix的作用

    在linux和unix环境中,源码安装是最常用的软件安装方式,一些软件出了提供源码外,也提供各种发行版的二进制安装包(如基于redhat包管理工具的rpm包),但强烈建议使用源码安装方式. 在linu ...

  3. linux 手动源码安装lnmp(亲测)

    linux 手动源码安装lnmp笔记(亲测)<pre>先安装这2个yum install gccyum install g++</pre><pre>先在linux ...

  4. Linux中源码安装编译Vim

    Linux中源码安装编译Vim Linux下学习工作少不了编辑器,Vim能使你的工作效率成倍的提高.在Ubuntu上安装vim使用命令直接安装很简单.但有时还是需要自己手动编译安装.例如: vim中的 ...

  5. linux下源码安装netcat

    linux下源码安装netcat http://blog.chinaunix.net/uid-20783755-id-4211230.html 1,下载netcat源码,netcat-0.7.1-13 ...

  6. CentOS7(Linux)源码安装Redis

    介绍 项目中经常需要用到Redis做缓存数据库,可是还有小伙伴不会在Linux上安装Redis,毕竟我们开发的项目都是要在服务器上运行的,今天就来讲讲如何在CentOS7环境使用源码进行安装Redis ...

  7. CentOS7(Linux)源码安装MySQL5.7.X

    介绍 软件应用最重要的就是数据库了,可是还有小伙伴不会在Linux上安装MySQL数据库,今天就来讲讲如何在CentOS7环境使用源码进行安装MySQL5.7.X. MySQL官网下载链接:https ...

  8. Linux下源码安装方式安装MySQL

    1.下载安装包:https://downloads.mysql.com/archives/community/  2.安装开发工具和安装包 因为要把源码编译成二进制数据,所以必须要有编译器和解释器 g ...

  9. linux(centos)源码安装git

    最近使用一个开源库,部署的的时候需要用git克隆依赖库.刚好系统没安装git.就尝试了源码安装git. 源码下载地址:http://codemonkey.org.uk/projects/git-sna ...

随机推荐

  1. Codeforces Round #347 (Div.2)_A. Complicated GCD

    题目链接:http://codeforces.com/contest/664/problem/A A. Complicated GCD time limit per test 1 second mem ...

  2. Ubuntu 18.04 一键安装深度截图工具 Deepin Screenshot

    一直在寻找Linux下的截图软件,终于发现了Deepin ScreenShot,其功能齐全,界面美观,唯一的缺点需要自己配置快捷键(后面会讲). 安装 直接在Ubuntu商店搜索“深度截图”,点击“安 ...

  3. fluent Python

    1.1 Python风格的纸牌 Python collections模块中的内置模块:namedtuple https://www.liaoxuefeng.com/wiki/0013747381250 ...

  4. Vuex基础-Getter

    官方地址:https://vuex.vuejs.org/zh/guide/getters.html Vuex 允许我们在 store 中定义“getter”(可以认为是 store 的计算属性).就像 ...

  5. Java +安卓 定时任务

    1.android 自带闹钟定时任务 安卓闹钟可以配合广播来实现(不推荐),系统资源浪费,安卓系统在5.0以后的定时 任务貌似触发时间不准了,因为了为了省电. //获取系统闹钟 AlarmManage ...

  6. PowerDesigner 图表导出Excel格式

    快捷方式打开运行界面:ctrl+shift+X '*************************************************************************** ...

  7. EL 和 JSTL 的使用

    EL Express Language 表达式语言 就是把<% 这里可以写java语言 %> 这种jsp的写法简化变为${ }的方式 例如 action="${pageConte ...

  8. 用IDEA搭建基于maven的springboot项目

     第一步:新建一个Project 第二步:选择Spring Initializr和SDK 然后next  第三步:修改Group和Artifact 第四步:按自己的需求选,这里我选的是Web,然后ne ...

  9. juicer

    function financingBodyTable(){ var jsonData = { FinancingBodyJSON:${relaListArr}//list数组 } var addMo ...

  10. 移动端h5页面meta标签设置

    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable= ...