1. <template>
  2. <name>centos72-source</name>
  3. <os>
  4. <name>CentOS-7</name>
  5. <version>2</version>
  6. <arch>x86_64</arch>
  7. <install type='iso'>
  8. <iso>file:///data/md0/iso/CentOS-7.2-x86_64-Minimal-1511.iso</iso>
  9. </install>
  10. <rootpw>Ct@2017Yun!@$%.CN</rootpw>
  11. </os>
  12. <disk>
  13. <size>20</size>
  14. </disk>
  15. <description>CentOS 7.2 x86_64</description>
  16. <packages>
  17. <package name='net-tools'/>
  18. <package name='acpid'/>
  19. <package name='cloud-utils-growpart'/>
  20. <package name='sysstat'/>
  21. </packages>
  22. <commands>
  23. <command name='install_qga'>
  24. cd /root
  25. tar xf qga.20171124.tar.gz
  26. cd qga
  27. bash ./install_qga_local.sh
  28. </command>
  29.  
  30. <command name='sed_profile'>
  31. echo "NOZEROCONF=yes" >> /etc/sysconfig/network
  32. rm -rf /etc/udev/rules.d/70-persistent-net.rules
  33. touch /etc/udev/rules.d/75-persistent-net-generator.rules
  34. chmod +x /var/lib/cloud/scripts/per-boot/resetroot
  35. chmod +x /var/lib/cloud/scripts/per-instance/ssh.sh
  36. chmod +x /usr/local/bin/nic_set_mq.sh
  37. echo "/usr/local/bin/nic_set_mq.sh > /tmp/nic_set_mq.log 2&gt;&amp;1" >> /etc/rc.d/rc.local
  38. chmod +x /etc/rc.d/rc.local
  39. </command>
  40.  
  41. <command name='install_Cloudinit_and_dependencies'>
  42. mkdir -p /root/.pip/
  43. yum install wget -y
  44. yum install epel-release -y
  45. yum clean all
  46. yum install python-pip -y
  47. pip install setuptools jinja2 prettytable oauthlib pyyaml requests jsonpatch jsonschema six --upgrade
  48. cd /root
  49. wget https://launchpad.net/cloud-init/trunk/17.1/+download/cloud-init-17.1.tar.gz
  50. tar -zxvf cloud-init-17.1.tar.gz
  51. cd ./cloud-init-17.1
  52. python setup.py build
  53. python setup.py install --init-system systemd
  54. </command>
  55.  
  56. <command name='console'>
  57. grub2-mkconfig -o /boot/grub2/grub.cfg
  58. </command>
  59.  
  60. <command name='services'>
  61. systemctl enable sshd
  62. systemctl disable firewalld
  63. systemctl enable cloud-init
  64. systemctl enable cloud-config
  65. systemctl enable cloud-final
  66. systemctl enable cloud-init-local
  67. systemctl enable acpid
  68. systemctl disable NetworkManager
  69. </command>
  70.  
  71. <command name='clear-logs'>
  72. rm -rf /root/*
  73. rm -rf /var/log/anaconda*
  74. rm -rf /var/log/message
  75. >/var/log/boot.log
  76. >/var/log/messages
  77. >/var/log/cloud-init-output.log
  78. >/var/log/yum.log
  79. >/var/log/lastlog
  80. </command>
  81. </commands>
  82.  
  83. <files>
  84. <file name="/root/qga.20171124.tar.gz" type="url">
  85. file:///data/nvme0n1/OZ-build-image/scripts/qga.20171124.tar.gz
  86. </file>
  87. <file name="/var/lib/cloud/scripts/per-boot/resetroot" type="url">
  88. file:///data/nvme0n1/OZ-build-image/scripts/resetroot
  89. </file>
  90. <file name="/etc/cloud/cloud.cfg" type="url">
  91. file:///data/nvme0n1/OZ-build-image/scripts/cloud.cfg_centos7
  92. </file>
  93. <file name="/usr/local/bin/nic_set_mq.sh" type="url">
  94. file:///data/nvme0n1/OZ-build-image/scripts/nic_set_mq.sh
  95. </file>
  96. <file name="/etc/default/grub" type="url">
  97. file:///data/nvme0n1/OZ-build-image/scripts/grub_centos7
  98. </file>
  99. <file name="/var/lib/cloud/scripts/per-instance/ssh.sh" type="url">
  100. file:///data/nvme0n1/OZ-build-image/scripts/ssh-centos7.ssh
  101. </file>
  102. <file name="/root/.pip/pip.conf" type="url">
  103. file:///data/nvme0n1/OZ-build-image/scripts/pip.conf
  104. </file>
  105. <file name="/lib/systemd/system/cloud-init-local.service" type="url">
  106. file:///data/nvme0n1/OZ-build-image/scripts/cloud-init-local.service
  107. </file>
  108. <file name="/lib/systemd/system/cloud-init.service" type="url">
  109. file:///data/nvme0n1/OZ-build-image/scripts/cloud-init.service
  110. </file>
  111. </files>
  112. </template>
  1. install
  2. text
  3. keyboard us
  4. lang en_US.UTF-8
  5. skipx
  6. network --device eth0 --bootproto dhcp --onboot=on
  7. rootpw Ct@2017Yun!@$%.CN
  8. firewall --disabled
  9. authconfig --enableshadow --enablemd5
  10. timezone --utc Asia/Shanghai
  11. selinux --disabled
  12. zerombr
  13. clearpart --all --drives=vda
  14. bootloader --location=mbr --append="console=tty0 console=ttyS0,115200n8"
  15. part / --fstype xfs --size=2048 --grow --ondisk=vda
  16. reboot
  17. %post
  18.  
  19. cat <<EOL >> /etc/rc.local
  20. if [ ! -d /root/.ssh ] ; then
  21. mkdir -p /root/.ssh
  22. chmod 0700 /root/.ssh
  23. restorecon /root/.ssh
  24. fi
  25. EOL
  26.  
  27. echo "ttyS0" >> /etc/securetty
  28. cat <<EOF > /etc/init/ttyS0.conf
  29. start on stopped rc RUNLEVEL=[2345]
  30. stop on starting runlevel [016]
  31. respawn
  32. instance /dev/ttyS0
  33. exec /sbin/agetty /dev/ttyS0 115200 vt100-nav
  34. EOF
  35. %end
  36. %packages --nobase --excludedocs
  37. %end

centos7源码安装cloud-init的更多相关文章

  1. centos7源码安装Python3的前提条件

    centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...

  2. centos7源码安装mysql5.7.19

    centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...

  3. Centos7源码安装mysql及读写分离,互为主从

       Linux服务器 -源码安装mysql 及读写分离,互为主从   一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...

  4. CentOS7 源码安装 PostgreSQL 12

    PostgreSQL 12 源码安装 Table of Contents 1. 下载 2. 准备环境 3. 编译安装 4. 设置环境变量 5. 初始化数据库 6. 配置参数文件 6.1. postgr ...

  5. Centos7源码安装Apache和PHP

    源码安装Apache 安装需要的依赖 yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel​# ...

  6. centos7源码安装Apache及Tomcat

    源码安装Apache (1) 一.通过 https://apr.apache.org/  下载 APR 和 APR-util 通过 http://httpd.apache.org/download.c ...

  7. CentOS7源码安装qbittorrent最新版本

    CentOS的软件 yum 里 yum search qbittorrent yum info qbittorrent 找到的是3.37版本 官网最新的是4.12版本.但需要源码安装: 官网下载最新版 ...

  8. CentOS7源码安装Redis5.0.4非关系型数据库

    源码安装redis-5.0.4 一. 下载redis 1. 需要连接网络 二. 案例(另一种安装方法) [root@localhost ~]# wget http://download.redis.i ...

  9. centos7 源码安装goaccess

    1. 使用yum安装在不同服务器上可能失败, 推荐使用源码安装goaccess # 安装依赖 yum install -y ncurses-devel GeoIP-devel.x86_64 tokyo ...

  10. centos7 源码安装指定版本的php7

    很多时候可能会遇到需要手动源码安装软件的时候,所以自己实践了一把,并且把安装过程中遇到的问题,以及在网上找到的解决办法(实测有效)都记录下来,方便日后学习实践. 1. 系统环境 # cat /etc/ ...

随机推荐

  1. CGAL 4.6 - Surface Reconstruction from Point Sets

    http://doc.cgal.org/latest/Surface_reconstruction_points_3/ The following example reads a point set, ...

  2. python 并发编程之协程

    一.协程 协程: 单线程下的并发,又称 微线程.协程是一种用户态的的轻量级线程,即协程是由用户程序自己控制调度的. ​ 协程的本质就是在单线程下,由用户自己控制一个任务,遇到 io 阻塞就切换另外一个 ...

  3. SpringBoot非官方教程 | 第二十三篇: 异步方法

    转载请标明出处: 原文首发于https://www.fangzhipeng.com/springboot/2017/07/11/springboot-ansy/ 本文出自方志朋的博客 这篇文章主要介绍 ...

  4. Unity 游戏框架搭建 (八) 减少加班利器-QLog

    为毛要实现这个工具? 在我小时候,每当游戏到了测试阶段,交给QA测试,QA测试了一会儿拿着设备过来说游戏闪退了....当我拿到设备后测了好久Bug也没有复现,排查了好久也没有头绪,就算接了Bugly拿 ...

  5. NSString+JSON - iOS

    日常开发中常用的一个相互转换的方法; 直接创建对应的类,引用如下方法即可实现; 具体 code 如下: 声明: #import <Foundation/Foundation.h> @int ...

  6. (eclipse)统一文件编码和代码风格

    前言 1>每个人的代码风格不一样,以至于代码各式各样,有习惯=号左右加空格的,有习惯不加的,此举有时还会影响svn提交代码 2>注释代码不一样,并且注释风格也不一样 统一文件编码和代码风格 ...

  7. [HNOI2003]操作系统(优先队列,堆排序)

    题目描述 写一个程序来模拟操作系统的进程调度.假设该系统只有一个CPU,每一个进程的到达时间,执行时间和运行优先级都是已知的.其中运行优先级用自然数表示,数字越大,则优先级越高. 如果一个进程到达的时 ...

  8. Jmeter的安装教程【图文】

    Jmeter是一款开源的测试工具,其安装分为两大部分:JDK和Jmeter 第一部分:安装JDK 第一步: 官网下载JDK,可以按照引用地址jdk下载教程进行下载,下载完毕后,进行安装即可 第二步: ...

  9. thinkphp 3.2中依靠关联模型来关联三个表

    这里说的是用thinkphp3.2关联模型关联三个表 根据用户表查询出三个表的数据,需要两个model来配合,第一个model是根据user表来查询到班级的信息,然后第二个model是根绝banji中 ...

  10. STM32CubeMx配置正交编码器遇到的问题

    配置时参考了这个哥们的方法: http://www.eemaker.com/stm32cubemx-encoder.html 然后我的配置是这样的 配置是没有问题. 调用时出现了问题. 由于配置完了, ...