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/ ...
随机推荐
- 【luogu P1268 树的重量】 题解
题目链接:https://www.luogu.org/problemnew/show/P1268 给定所有点间的最短路求原图所有路径和 形如: 我们需要计算红边+绿边 绿边 = (红边+蓝边+紫边)/ ...
- [luoguP3627][APIO2009]抢掠计划
先来看一下题目描述: 题目描述 Siruseri 城中的道路都是单向的.不同的道路由路口连接.按照法律的规定, 在每个路口都设立了一个 Siruseri 银行的 ATM 取款机.令人奇怪的是,Siru ...
- 【题解】洛谷P1066 [NOIP2006TG] 2^k进制数(复杂高精+组合推导)
洛谷P1066:https://www.luogu.org/problemnew/show/P1066 思路 挺难的一道题 也很复杂 满足题目要求的种数是两类组合数之和 r的最多位数m为 w/k(当w ...
- plsql Developer11的工具栏没有了如何找回来
以前都是用的plsql developer7,最常用的工具类如下: 这次下载了12,发现风格变了,经常用的执行.提交.回滚按钮都在会话菜单下了 如何找回工具栏呢,如下操作:
- Unity 游戏框架搭建 (十三) 无需继承的单例的模板
之前的文章中介绍的Unity 游戏框架搭建 (二) 单例的模板和Unity 游戏框架搭建 (三) MonoBehaviour单例的模板有一些问题. 存在的问题: 只要继承了单例的模板就无法再继承其他的 ...
- 2小时学会spring boot 以及spring boot进阶之web进阶(已完成)
1:更换Maven默认中心仓库的方法 <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirr ...
- 不再手写import - VSCode自动引入Vue组件和Js模块
:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdow ...
- [HAOI2007]上升序列(最长上升子序列)
题目描述 对于一个给定的 S=\{a_1,a_2,a_3,…,a_n\}S={a1,a2,a3,…,an} ,若有 P=\{a_{x_1},a_{x_2},a_{x_3},…,a_{x_m}\ ...
- 使用Ansible实现nginx+keepalived高可用负载均衡自动化部署
本篇文章记录通过Ansible自动化部署nginx的负载均衡高可用,前端代理使用nginx+keepalived,端web server使用3台nginx用于负载效果的体现,结构图如下: 部署前准备工 ...
- 高级同步器:同步屏障CyclicBarrier
引自:http://ifeve.com/concurrency-cyclicbarrier/ 简介 CyclicBarrier 的字面意思是可循环使用(Cyclic)的屏障(Barrier).它要做的 ...