centos7源码安装cloud-init

摘要:
centos72-sourceCentOS-72x86_64file:///data/md0/iso/CentOS-7.2-x86_64-Minimal-1511.iso˂ro
<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.1python 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>
View Code
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
View Code

免责声明:文章转载自《centos7源码安装cloud-init》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇全网最通俗易懂理清mybatis中SqlSession、SqlSessionTemplate、SessionFactory和SqlSessionFactoryBean之间的关系xcode 自动添加注释,生成文档下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Selenium2+python自动化37-爬页面源码(page_source)【转载】

前言 有时候通过元素的属性的查找页面上的某个元素,可能不太好找,这时候可以从源码中爬出想要的信息。selenium的page_source方法可以获取到页面源码。 selenium的page_source方法很少有人用到,小编最近看api不小心发现这个方法,于是突发奇想,这里结合python的re模块用正则表达式爬出页面上所有的url地址,可以批量请求页面...

Vue.js 源码分析(二十七) 高级应用 异步组件 详解

当我们的项目足够大,使用的组件就会很多,此时如果一次性加载所有的组件是比较花费时间的。一开始就把所有的组件都加载是没必要的一笔开销,此时可以用异步组件来优化一下。 异步组件简单的说就是只有等到在页面里显示该组件的时候才会从服务器加载,不显式的话就不会加载,这样即可提高客户端的访问速度也可以降低对服务器的请求次数,可谓优化的一个利器。 异步组件常用有3种异步...

mybatis源码分析(5)-----拦截器的实现原理(动态代理+责任链)

写在前面   MyBatsi 的拦截器模式是基于代理的代理模式。并且myBatis 的插件开发也是以拦截器的形式集成到myBatis 当中。   MyBatis 的拦截器已经插件是在org.apache.ibatis.plugin包下面。   MyBatis拦截器可以拦截的类,Executor(执行器),ParameterHandler(参数处理器),R...

vuex源码解析及简单实现

vuex源码解析 目录 vuex源码解析 一、vuex的使用回顾 二、逐句剖析vuex的使用 1. vue.use( ) 2. new Vuex.Store( ) 3. action 三、刻画vuex 的大致结构 四、完成 install 方法 五、完成 Store 中的 state 六、完成 Store 中的 getters 七、完成 Stor...

【spring源码系列】之【环境搭建】

1. gradle安装 1.1 下载gradle gradle官网下载对应的版本,笔者用的6.0.1,下载地址如下https://gradle.org/releases/,找到6.0.1,选择complete连接下载,如下图 1.2 配置环境变量 解压gradle到指定目录,配置环境变量GRADLE_HOME、Path,与JDK类似,如下图 在命令行输入g...

SVN源码服务器搭建-详细教程

一、引言      笔者曾经试图在网上搜索一篇关于SVN源代码服务器搭建方面的中文技术文章,可惜,所找到的,要么是不完整,要么就是对笔者没什么帮助的文章,TortoiseSvn的帮助文档固然强大,但因为是英文,不是很适合来作为入门者使用;毕竟,TortoiseSvn是一个客户端,服务器端的配置也很重要。       一年前,笔者刚刚毕业,初入公司,在进行开...