centos7源码安装cloud-init
<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>&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的更多相关文章
- centos7源码安装Python3的前提条件
centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...
- centos7源码安装mysql5.7.19
centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...
- Centos7源码安装mysql及读写分离,互为主从
Linux服务器 -源码安装mysql 及读写分离,互为主从 一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...
- CentOS7 源码安装 PostgreSQL 12
PostgreSQL 12 源码安装 Table of Contents 1. 下载 2. 准备环境 3. 编译安装 4. 设置环境变量 5. 初始化数据库 6. 配置参数文件 6.1. postgr ...
- Centos7源码安装Apache和PHP
源码安装Apache 安装需要的依赖 yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel# ...
- centos7源码安装Apache及Tomcat
源码安装Apache (1) 一.通过 https://apr.apache.org/ 下载 APR 和 APR-util 通过 http://httpd.apache.org/download.c ...
- CentOS7源码安装qbittorrent最新版本
CentOS的软件 yum 里 yum search qbittorrent yum info qbittorrent 找到的是3.37版本 官网最新的是4.12版本.但需要源码安装: 官网下载最新版 ...
- CentOS7源码安装Redis5.0.4非关系型数据库
源码安装redis-5.0.4 一. 下载redis 1. 需要连接网络 二. 案例(另一种安装方法) [root@localhost ~]# wget http://download.redis.i ...
- centos7 源码安装goaccess
1. 使用yum安装在不同服务器上可能失败, 推荐使用源码安装goaccess # 安装依赖 yum install -y ncurses-devel GeoIP-devel.x86_64 tokyo ...
- centos7 源码安装指定版本的php7
很多时候可能会遇到需要手动源码安装软件的时候,所以自己实践了一把,并且把安装过程中遇到的问题,以及在网上找到的解决办法(实测有效)都记录下来,方便日后学习实践. 1. 系统环境 # cat /etc/ ...
随机推荐
- ASP.NET整体运行机制+asp.net请求管道+页面生命周期
- HttpHandler使用Session
继承自IHttpHandler的类要实现两个接口:ProcessRequest和IsReusable但还不能使用Session,要使用Session需要下面的步骤处理: 1.先引用System.Web ...
- 表达式过滤器 uppercase
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- 学习MySql和MongoDB笔记
首先了解下关系型数据库和非关系型数据库 关系型数据库 SQL关系型数据库采用了关系模式来组织数据,即关系模式为二维表格模型. 主要的数据库:SQL Server,Oracle,Mysql,Postgr ...
- Linux/Mac scp命令笔记
scp命令用于Linux之间复制文件和目录. 参数说明: -1: 强制scp命令使用协议ssh1-2: 强制scp命令使用协议ssh2-4: 强制scp命令只使用IPv4寻址-6: 强制scp命令只使 ...
- 基于 UIImagePickerController 的拓展封装 - iOS
基于 UIImagePickerController 的拓展,分别支持调用相机.相册的功能,其中相机可以设置默认调用前后摄像头; 简单对此进行了封装和实现,其中还有很多点可以继续挖掘和优化,该版本具体 ...
- Vue--- VueX组件间通信链接(共有方法放入了扩展目录store里面) 1.2
Vuex结构图再仔细看 Vuex原理: 就是 把共有属性放入到一个公共的地方,进行使用 多组件共享状态, 之前操作方式,由父组件传递到各个子组件. 当路由等加入后,会变得复杂. 引入viewx 解决 ...
- java实现简单计算器功能
童鞋们,是不是有使用计算器的时候,还要进入运行,输入calc,太麻烦了,有时候甚至还忘记单词怎么拼写,呵呵程序员自己写代码实现,又简单,又方便啊 以下为代码(想要生成可执行工具可参考:http://w ...
- BZOJ1086: [SCOI2005]王室联邦(贪心,分块?)
Time Limit: 10 Sec Memory Limit: 162 MBSec Special JudgeSubmit: 2610 Solved: 1584[Submit][Status] ...
- ABAP术语-Field
Field 原文:http://www.cnblogs.com/qiangsheng/archive/2008/02/01/1061244.html Name in an ABAP program f ...