<template>
<name>centos72-source</name>
<os>
<name>CentOS-7</name>
<version>2</version>
<arch>x86_64</arch>
<install type='iso'>
<iso>file:///data/md0/iso/CentOS-7.2-x86_64-Minimal-1511.iso</iso>
</install>
<rootpw>Ct@2017Yun!@$%.CN</rootpw>
</os>
<disk>
<size>20</size>
</disk>
<description>CentOS 7.2 x86_64</description>
<packages>
<package name='net-tools'/>
<package name='acpid'/>
<package name='cloud-utils-growpart'/>
<package name='sysstat'/>
</packages>
<commands>
<command name='install_qga'>
cd /root
tar xf qga.20171124.tar.gz
cd qga
bash ./install_qga_local.sh
</command> <command name='sed_profile'>
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
rm -rf /etc/udev/rules.d/70-persistent-net.rules
touch /etc/udev/rules.d/75-persistent-net-generator.rules
chmod +x /var/lib/cloud/scripts/per-boot/resetroot
chmod +x /var/lib/cloud/scripts/per-instance/ssh.sh
chmod +x /usr/local/bin/nic_set_mq.sh
echo "/usr/local/bin/nic_set_mq.sh > /tmp/nic_set_mq.log 2&gt;&amp;1" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
</command> <command name='install_Cloudinit_and_dependencies'>
mkdir -p /root/.pip/
yum install wget -y
yum install epel-release -y
yum clean all
yum install python-pip -y
pip install setuptools jinja2 prettytable oauthlib pyyaml requests jsonpatch jsonschema six --upgrade
cd /root
wget https://launchpad.net/cloud-init/trunk/17.1/+download/cloud-init-17.1.tar.gz
tar -zxvf cloud-init-17.1.tar.gz
cd ./cloud-init-17.1
python setup.py build
python setup.py install --init-system systemd
</command> <command name='console'>
grub2-mkconfig -o /boot/grub2/grub.cfg
</command> <command name='services'>
systemctl enable sshd
systemctl disable firewalld
systemctl enable cloud-init
systemctl enable cloud-config
systemctl enable cloud-final
systemctl enable cloud-init-local
systemctl enable acpid
systemctl disable NetworkManager
</command> <command name='clear-logs'>
rm -rf /root/*
rm -rf /var/log/anaconda*
rm -rf /var/log/message
>/var/log/boot.log
>/var/log/messages
>/var/log/cloud-init-output.log
>/var/log/yum.log
>/var/log/lastlog
</command>
</commands> <files>
<file name="/root/qga.20171124.tar.gz" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/qga.20171124.tar.gz
</file>
<file name="/var/lib/cloud/scripts/per-boot/resetroot" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/resetroot
</file>
<file name="/etc/cloud/cloud.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/cloud.cfg_centos7
</file>
<file name="/usr/local/bin/nic_set_mq.sh" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/nic_set_mq.sh
</file>
<file name="/etc/default/grub" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/grub_centos7
</file>
<file name="/var/lib/cloud/scripts/per-instance/ssh.sh" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/ssh-centos7.ssh
</file>
<file name="/root/.pip/pip.conf" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/pip.conf
</file>
<file name="/lib/systemd/system/cloud-init-local.service" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/cloud-init-local.service
</file>
<file name="/lib/systemd/system/cloud-init.service" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/cloud-init.service
</file>
</files>
</template>
install
text
keyboard us
lang en_US.UTF-8
skipx
network --device eth0 --bootproto dhcp --onboot=on
rootpw Ct@2017Yun!@$%.CN
firewall --disabled
authconfig --enableshadow --enablemd5
timezone --utc Asia/Shanghai
selinux --disabled
zerombr
clearpart --all --drives=vda
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200n8"
part / --fstype xfs --size=2048 --grow --ondisk=vda
reboot
%post cat <<EOL >> /etc/rc.local
if [ ! -d /root/.ssh ] ; then
mkdir -p /root/.ssh
chmod 0700 /root/.ssh
restorecon /root/.ssh
fi
EOL echo "ttyS0" >> /etc/securetty
cat <<EOF > /etc/init/ttyS0.conf
start on stopped rc RUNLEVEL=[2345]
stop on starting runlevel [016]
respawn
instance /dev/ttyS0
exec /sbin/agetty /dev/ttyS0 115200 vt100-nav
EOF
%end
%packages --nobase --excludedocs
%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. 取火柴游戏||Nim博弈

    好久之前看的sg函数了 好像就记住一个nim博弈qwq 第一次啊看的时候很迷,现在感觉可以了qwq 首先我们来看一个其他的游戏.(以下游戏只有两个人参与,且足够聪明) 两个人在一张圆形的桌子上放等大的 ...

  2. 【洛谷P2184】贪婪大陆

    贪婪大陆 题目链接 对于一个区间[l,r],右端点在l左边即[1,l-1]中的区间与区间[l,r]没有交集, 左端点在r右边即[r,n]中的区间与区间[l,r]没有交集, 其余区间必与[l,r]有交集 ...

  3. AngularJS 使用序号的表格

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  4. HTML基础之标签简单认识

    简介 HTML(Hyper Text Markup Language)译为"超文本标记语言",主要是通过HTML标记对网页中的文本.图片.声音等内容进行描述 HTML之所以称为超文 ...

  5. css3 动画应用 animations 和transtions transform在加上JavaScript 可以实现硬件加速动画。

    transitions(过渡) 被应用于元素指定的属性变化时,该属性经过一段时间逐渐的过渡到最终想要的值. 主要包括四个属性: 执行变换的属性:transition-property 变换延续的时间: ...

  6. 『嗨威说』常见的C++函数模板整理(一)

    开学两天,身上的职责直接变为两个班班长,三个小组组长,哇这事情估计够我忙活了,想躲都躲不掉啊,看来我还是真招人推荐各种管理职务啊,以后要是有人推荐我当经理啊领导啊该多好哈哈哈哈.记得今天奶奶生日,很开 ...

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

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

  8. ABAP术语-Document Number

    Document Number 原文:http://www.cnblogs.com/qiangsheng/archive/2008/01/28/1055636.html Key which ident ...

  9. 解决WordPress设置错误的url网站不能访问的问题

    通过WordPress后台首选项更改了网站url地址之后,网站就会出现访问不了的情况,一般来说,网站后台也登陆不上去了,我从网上寻找到了四种方法,这四种方法前三种都是需要登陆到后台的,但实际上出错后, ...

  10. IDEA项目启动报Unable to open debugger port (127.0.0.1:51554): java.net.SocketException "socket closed"

    启动报错: Unable to open debugger port (127.0.0.1:51554): java.net.SocketException "socket closed&q ...