参考: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. 1.5配置NetBackup数据库备份策略(nbu策略catalog)

    1.5配置NetBackup数据库备份策略 建议定期备份NetBackup的索引数据库Catalog,以确保故障时的有效恢复.从Javaconsole可以进入备份NetBackup内部数据库配置窗口, ...

  2. 会话技术: Cookie Session JSP

    ##  Cookie A..概念:客户端会话技术,将数据保存到客户端 B.使用步骤: 1.创建Cookie对象,绑定数据 new Cookie(String  name, String value) ...

  3. memcache 基本操作

    输入 telnet  localhost 11211 步骤: 1.输入 set hans 0 0 3 回车 2. 输入 123  回车 3. get  hans 回车 删除操作,输入 delete h ...

  4. 自己编写shave函数

    import numpy def shave(I,border=None): I = I[border[0]:I.shape[0]-border[0],border[1]:I.shape[1]-bor ...

  5. Firefox 修改User Agent

    Android 版 Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML ...

  6. 史上最简单的SpringCloud教程 | 第十二篇: 断路器监控(Hystrix Dashboard)

    转载请标明出处: 首发于:https://www.fangzhipeng.com/springcloud/2017/07/12/sc12-hystix-dashbd/ 本文出自方志朋的博客 最新Fin ...

  7. React Native ref高级用法&&setNativeProps使用

    ref属性不只是string ref属性不仅接受string类型的参数,而且它还接受一个function作为 callback.这一特性让开发者对ref的使用更加灵活. render() { retu ...

  8. Angular之简单的登录注册

    使用Angular实现了一个简单的登录注册的功能........ 涉及到的Angular知识点很少 主要是这个功能的实现...(*^__^*) 嘻嘻…… 里面涉及到的知识点记录: 1.本地存储的操作 ...

  9. 字符串替换For linux C

    1.临时空间给了个1024,不需要可减少长度. 2.结果只用用strcpy了,没校验. bool Replace(char *str,const char *src, const char *des) ...

  10. vue学习--父子组件通讯

    this.$parent        // 子组件访问父组件 this.$root            // 访问根实例 this.$children        // 父组件的所有子元素 *一 ...