Oz 创建Ubuntu镜像
参考链接:
http://blog.csdn.net/gcogle/article/details/52767135
http://tlinux.blog.51cto.com/7288656/1749749/
http://blog.csdn.net/coolper/article/details/51279328
https://github.com/dl528888/oz_create_openstack_image_templateshttp://lm3810.blog.51cto.com/846925/1860546/http://www.linuxidc.com/Linux/2017-10/147477.htm
<template>
<name>qemu-ubuntu1204</name>
<os>
<name>Ubuntu</name>
<version>12.04</version>
<arch>x86_64</arch>
<install type='iso'>
<iso>file:///data/md0/iso/ubuntu-12.04.5-server-amd64.iso</iso>
</install>
<rootpw>123123</rootpw>
</os>
<disk>
<size>20</size>
</disk>
<description>Ubuntu 12.04 x86_64</description>
<commands>
<command name='install_qga'>
cd /root
tar xf qga.20171124.tar.gz
cd qga
bash -x ./install_qga_local.sh
</command> <command name='console'>
sed -i 's/splash//g' /etc/default/grub
sed -i 's/quiet/console=ttyS0/g' /etc/default/grub
/usr/sbin/update-grub
</command> <command name='packages'>
rm -rf /etc/apt/sources.list
mv /root/sources.list /etc/apt/
rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
apt-get -y upgrade
apt-get -y install acpid
apt-get -y install landscape-common
apt-get -y install update-notifier-common
apt-get -y install sysv-rc-conf
apt-get -y install network-manager
apt-get -y install cloud-init-*
apt-get -y install cloud-utils-growpart
</command> <command name='modify'>
echo -n > /etc/udev/rules.d/70-persistent-net.rules
echo -n > /lib/udev/rules.d/75-persistent-net-generator.rules
sed -i '/exit 0/d' /etc/rc.local
echo "/usr/local/bin/nic_set_mq.sh > /tmp/nic_set_mq.log 2>&1" >> /etc/rc.local
echo "exit 0">>/etc/rc.local
echo 'blacklist intel_rapl' >> /etc/modprobe.d/modprobe.conf
chmod +x /var/lib/cloud/scripts/per-boot/resetroot
chmod +x /usr/local/bin/nic_set_mq.sh
chmod +x /var/lib/cloud/scripts/per-instance/ssh.sh
chmod +x /etc/rc.local
rm -rf /etc/cloud/cloud.cfg
rm -rf /etc/cloud/cloud.cfg.d/90_dpkg.cfg
mv /root/cloud.cfg /etc/cloud/
mv /root/90_dpkg.cfg /etc/cloud/cloud.cfg.d/
cat >> /usr/local/bin/instance_init.sh << EOF
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
</command> <command name='services'>
apt-get -y upgrade
sysv-rc-conf acpid on
sysv-rc-conf ufw off
sysv-rc-conf network-manager on
sysv-rc-conf cloud-init on
sysv-rc-conf cloud-config on
sysv-rc-conf cloud-final on
sysv-rc-conf cloud-init-local on
sysv-rc-conf qemu-guest-agent on
</command> <command name='clear-logs'>
rm -rf /root/*
rm -rf /var/log/alternatives.log
rm -rf /var/log/auth.log
rm -rf /var/log/dpkg.log
rm -rf /var/log/fontconfig.log
rm -rf /var/log/boot.log
rm -rf /var/log/syslog
rm -rf /var/log/kern.log
rm -rf /var/log/cloud-init.log
rm -rf /var/log/cloud-init-output.log
rm -rf /var/log/btmp
rm -rf /var/log/wtmp
rm -rf /var/log/yum.log
rm -rf /var/log/lastlog
rm -rf /var/log/installer/
rm -rf /var/log/apt/
rm -rf /var/lib/apt/lists/*
</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="/root/cloud.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/cloud.cfg_u1204
</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="/var/lib/cloud/scripts/per-instance/ssh.sh" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/ssh-ubuntu1204.sh
</file>
<file name="/root/sources.list" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/sources.cn.ubuntu.p.list
</file>
<file name="/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/99-disable-network-config.cfg
</file>
<file name="/root/90_dpkg.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/90_dpkg.cfg_u1204
</file>
<file name="/etc/default/grub" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/grub_ubuntu
</file>
</files>
</template>
ubuntu1204.tdl
<template>
<name>qemu-ubuntu1404</name>
<os>
<name>Ubuntu</name>
<version>14.04</version>
<arch>x86_64</arch>
<install type='iso'>
<iso>file:///data/md0/iso/ubuntu-14.04.5-server-amd64.iso</iso>
</install>
<rootpw>123123</rootpw>
</os>
<disk>
<size>20</size>
</disk>
<description>Ubuntu 14.04 x86_64</description>
<commands>
<command name='install_qga'>
cd /root
tar xf qga.20171124.tar.gz
cd qga
bash -x ./install_qga_local.sh
</command> <command name='console'>
sed -i 's/splash//g' /etc/default/grub
sed -i 's/quiet/console=ttyS0/g' /etc/default/grub
/usr/sbin/update-grub
</command> <command name='packages'>
rm -rf /etc/apt/sources.list
mv /root/sources.list /etc/apt/
rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
apt-get -y upgrade
apt-get -y install landscape-common
apt-get -y install update-notifier-common
apt-get -y install acpid
apt-get -y install sysv-rc-conf
apt-get -y install network-manager
apt-get -y install cloud-init-*
apt-get -y install cloud-utils-growpart
</command> <command name='modify'>
echo -n > /etc/udev/rules.d/70-persistent-net.rules
echo -n > /lib/udev/rules.d/75-persistent-net-generator.rules
sed -i '/exit 0/d' /etc/rc.local
echo "/usr/local/bin/nic_set_mq.sh > /tmp/nic_set_mq.log 2>&1" >> /etc/rc.local
echo "exit 0">>/etc/rc.local
echo 'blacklist intel_rapl' >> /etc/modprobe.d/modprobe.conf
chmod +x /var/lib/cloud/scripts/per-boot/resetroot
chmod +x /usr/local/bin/nic_set_mq.sh
chmod +x /var/lib/cloud/scripts/per-instance/ssh.sh
chmod +x /etc/rc.local
rm -rf /etc/cloud/cloud.cfg
rm -rf /etc/cloud/cloud.cfg.d/90_dpkg.cfg
mv /root/cloud.cfg /etc/cloud/
mv /root/90_dpkg.cfg /etc/cloud/cloud.cfg.d/
cat >> /usr/local/bin/instance_init.sh << EOF
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
</command> <command name='services'>
apt-get -y upgrade
sysv-rc-conf acpid on
sysv-rc-conf ufw off
sysv-rc-conf qemu-guest-agent on
sysv-rc-conf network-manager on
sysv-rc-conf cloud-init on
sysv-rc-conf cloud-config on
sysv-rc-conf cloud-final on
sysv-rc-conf cloud-init-local on
</command> <command name='clear-logs'>
rm -rf /root/*
rm -rf /var/log/alternatives.log
rm -rf /var/log/auth.log
rm -rf /var/log/dpkg.log
rm -rf /var/log/fontconfig.log
rm -rf /var/log/boot.log
rm -rf /var/log/syslog
rm -rf /var/log/kern.log
rm -rf /var/log/cloud-init.log
rm -rf /var/log/cloud-init-output.log
rm -rf /var/log/btmp
rm -rf /var/log/wtmp
rm -rf /var/log/yum.log
rm -rf /var/log/lastlog
rm -rf /var/log/installer/
rm -rf /var/log/apt/
rm -rf /var/lib/apt/lists/*
</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="/root/cloud.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/cloud.cfg_u1404
</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="/var/lib/cloud/scripts/per-instance/ssh.sh" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/ssh-ubuntu1404.sh
</file>
<file name="/root/sources.list" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/sources.cn.ubuntu.t.list
</file>
<file name="/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/99-disable-network-config.cfg
</file>
<file name="/root/90_dpkg.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/90_dpkg.cfg_u1404
</file>
<file name="/etc/default/grub" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/grub_ubuntu
</file>
</files>
</template>
ubuntu1404.tdl
<template>
<name>qemu-ubuntu1604</name>
<os>
<name>Ubuntu</name>
<version>16.04</version>
<arch>x86_64</arch>
<install type='iso'>
<iso>file:///data/md0/iso/ubuntu-16.04.3-server-amd64.iso</iso>
</install>
<rootpw>123123</rootpw>
</os>
<disk>
<size>20</size>
</disk>
<description>Ubuntu 16.04 x86_64</description>
<commands>
<command name='install_qga'>
cd /root
tar xf qga.20171124.tar.gz
cd qga
bash -x ./install_qga_local.sh
</command> <command name='console'>
sed -i 's/splash//g' /etc/default/grub
sed -i 's/quiet/console=ttyS0/g' /etc/default/grub
/usr/sbin/update-grub
</command> <command name='packages'>
rm -rf /etc/apt/sources.list
mv /root/sources.list /etc/apt/
rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
apt-get -y upgrade
apt-get -y install landscape-common
apt-get -y install update-notifier-common
apt-get -y install sysv-rc-conf
apt-get -y install acpid
apt-get -y install network-manager
apt-get -y install cloud-init-*
apt-get -y install cloud-utils-growpart
</command> <command name='modify'>
echo -n > /etc/udev/rules.d/70-persistent-net.rules
echo -n > /lib/udev/rules.d/75-persistent-net-generator.rules
sed -i '/exit 0/d' /etc/rc.local
echo "/usr/local/bin/nic_set_mq.sh > /tmp/nic_set_mq.log 2>&1" >> /etc/rc.local
echo "exit 0">>/etc/rc.local
echo 'blacklist intel_rapl' >> /etc/modprobe.d/modprobe.conf
chmod +x /var/lib/cloud/scripts/per-boot/resetroot
chmod +x /usr/local/bin/nic_set_mq.sh
chmod +x /var/lib/cloud/scripts/per-instance/ssh.sh
chmod +x /etc/rc.local
rm -rf /etc/cloud/cloud.cfg
rm -rf /etc/cloud/cloud.cfg.d/90_dpkg.cfg
mv /root/cloud.cfg /etc/cloud/
mv /root/90_dpkg.cfg /etc/cloud/cloud.cfg.d/
touch /var/lib/cloud/instance/warnings/.skip
cat >> /usr/local/bin/instance_init.sh << EOF
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
</command> <command name='services'>
apt-get -y upgrade
update-rc.d ufw disable
update-rc.d qemu-guest-agent defaults
update-rc.d network-manager defaults
systemctl enable acpid
systemctl enable cloud-init
systemctl enable cloud-config
systemctl enable cloud-final
systemctl enable cloud-init-local
</command> <command name='clear-logs'>
rm -rf /root/*
rm -rf /var/log/alternatives.log
rm -rf /var/log/auth.log
rm -rf /var/log/dpkg.log
rm -rf /var/log/fontconfig.log
rm -rf /var/log/boot.log
rm -rf /var/log/syslog
rm -rf /var/log/kern.log
rm -rf /var/log/cloud-init.log
rm -rf /var/log/cloud-init-output.log
rm -rf /var/log/btmp
rm -rf /var/log/wtmp
rm -rf /var/log/yum.log
rm -rf /var/log/lastlog
rm -rf /var/log/installer/
rm -rf /var/log/apt/
rm -rf /var/lib/apt/lists/*
</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="/root/cloud.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/cloud.cfg_u1604
</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="/var/lib/cloud/scripts/per-instance/ssh.sh" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/ssh-ubuntu1604.sh
</file>
<file name="/root/sources.list" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/sources.cn.ubuntu.x.list
</file>
<file name="/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/99-disable-network-config.cfg
</file>
<file name="/root/90_dpkg.cfg" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/90_dpkg.cfg_u1604
</file>
<file name="/etc/default/grub" type="url">
file:///data/nvme0n1/OZ-build-image/scripts/grub_ubuntu
</file>
</files>
</template>
ubuntu1604.tdl
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true
d-i time/zone string Asia/Shanghai d-i partman-auto/disk string /dev/vda
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string root :: 2048 50 1000000 ext4 \
$primary{ } $bootable{ } method{ format } \
format{ } use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.
d-i partman-auto/choose_recipe select root
d-i partman-auto/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-partitioning/default_label select msdos d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
d-i passwd/root-password password Ct@2017Yun!@$%.CN
d-i passwd/root-password-again password Ct@2017Yun!@$%.CN tasksel tasksel/first multiselect standard
d-i pkgsel/include/install-recommends boolean true
d-i pkgsel/include string openssh-server curl d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string
base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note
ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note
ubuntu.ks
Oz 创建Ubuntu镜像的更多相关文章
- Oz 创建CentOS7镜像
参考链接: https://github.com/clalancette/oz/wiki/Oz-template-description-language https://github.com/cla ...
- Oz 创建CentOS6镜像
参考 http://linuxblind.blog.51cto.com/7616603/1655550/ http://www.chenshake.com/oz-making-centos-mirro ...
- Oz 创建Windows2008R2镜像
此tdl和auto文件只可定义windows disk bus以ide模式启动,不支持virtio. <template> <name>Windows-gushiren< ...
- Oz 创建Debian8镜像
<template> <name>Debian8.7-zxy</name> <os> <name>Debian</name> & ...
- Docker学习笔记之创建Ubuntu基础镜像
在创建基础镜像之前需要安装Bootstrap工具debootstrap,所以执行命令: sudo apt install debootstrap 软件安装完成后就可以使用debootstrap工具下载 ...
- 创建ubuntu软件源
缘起:虚拟机需要安装一些文件,但是直接从外网下载比较慢,而且安装iso包中是有这些软件的,所以创建一个ubuntu apt server ubuntu 12.04, 本机192.168.0.124, ...
- 搭建本地Ubuntu 镜像服务器
一.需求分析 最近公司软件Team 有个需求是这样的:能不能在局域网搭建一个Ubuntu 镜像服务器, 这样作的好处是可以节省Ubuntu某些常用工具的安装时间. 二.部署过程 2.1 测试环境 目前 ...
- VMware Workstation 软件 创建 Ubuntu 14.04虚拟机
VMware Workstation 软件 创建 Ubuntu 14.04虚拟机 1. 安装VMare Workstation 软件 下载VMware 11 软件 http://www.dntk.or ...
- 创建新镜像-从已创建的容器中更新镜像并提交镜像(以Nginx为例)
目标:现在我们主要是修改nginx的index.html,然后做一个新镜像 1.基于nginx:1.12运行一个容器 docker run -d -p 8080:80 --name nginx ngi ...
随机推荐
- Javascript Number.MIN_VALUE
一.Number.MIN_VALUE属性属于静态Number对象.这代表了尽可能小的正数的JavaScript可以工作的常量. 该常量的实际值是 5 x 10-324 语法访问属性: var val ...
- Day2 数据类型和运算符
基本数据类型 Java 是一种强类型的语言,声明变量时必须指明数据类型.变量(variable)的值占据一定的内存空间.不同类型的变量占据不同的大小.Java中共有8种基本数据类型,包括4 种整型.2 ...
- mongodb启动与运用
在操作前需要启动mongodb数据库服务 1.首先打开dos窗口,然后选择路径到你的安装路径下的bin目录(我的路径是的D:mongo\mongodb\bin) 2.然后输入启动命令(D:mongo\ ...
- cpu负载过高分析
如何定位是哪个服务进程导致CPU过载,哪个线程导致CPU过载,哪段代码导致CPU过载? 步骤一.找到最耗CPU的进程 工具:top 方法: 执行top -c ,显示进程运行信息列表 键入P (大写p) ...
- P1776 宝物筛选_NOI导刊2010提高(02)
题目描述 终于,破解了千年的难题.小FF找到了王室的宝物室,里面堆满了无数价值连城的宝物……这下小FF可发财了,嘎嘎.但是这里的宝物实在是太多了,小FF的采集车似乎装不下那么多宝物.看来小FF只能含泪 ...
- B. Sleepy Game
http://codeforces.com/problemset/problem/936/B Petya and Vasya arranged a game. The game runs by the ...
- Linux磁盘与文件系统管理(一)
fdisk 常用的磁盘分区工具,受mbr分区表的限制,只能给小于2TB的磁盘划分分区,如果使用fdisk对大于2TB的磁盘进行分区,虽然可以分区,但只能识别2T的空间,一般使用parted分区工具 - ...
- JS 判断滚动底部并加载更多效果。。。。。。。。。
JS 判断滚动底部并加载更多效果......... <html lang="zh-cn"> <head> <meta http-equiv=" ...
- c++ 以多维数组的形式访问动态内存
教学内容: 以多维数组的形式访问动态内存 六.作业 .]=(]) *sizeof(int)); 以 pNum[][]形式访问内存空间. //8*3 [8][3] ]; int i,j,n; n=; p ...
- 洛谷 1440 求m区间内的最小值
洛谷 1440 求m区间内的最小值 题目描述 一个含有n项的数列(n<=2000000),求出每一项前的m个数到它这个区间内的最小值.若前面的数不足m项则从第1个数开始,若前面没有数则输出0. ...