Ubuntu 1404 image for openstack

1> prepare the image with kvm

virt-install \
--name os-u1404 \
--ram 4096 \
--disk path=/var/lib/libvirt/images/os-u1404.img,format=qcow2,size=30 \
--vcpus 2 \
--os-type linux \
--os-variant ubuntutrusty \
--network bridge=br0 --graphics none  \
--console pty,target_type=serial \
--location 'http://192.168.3.17/ubuntu/dists/trusty/installer-amd64/' --extra-args 'console=ttyS0,115200n8 serial'

通过3.17这个服务器提供网络安装启动源。
启动后选择手工输入安装源, 输入

mirrors.aliyun.com

安装组件选取OpenSSH服务,其他服务可以不用选择,留待需要时候再安装。

2>update and install packages

检查更新apt的源文件 /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

更改几个系统配置

vi /etc/ssh/ssd_config
    "PermitRootLogin yes"
----------
vi /etc/default/grub
    "GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0""
update-grub2

更新和安装其他几个软件

apt-get update
apt-get install ntp acpi nmon vim-runtime 
apt-get -y dist-upgrade
reboot
shutdown -h now

备份这个镜像文件作为其他试验的基础。

cp /var/lib/libvirt/images/os-u1404.img /var/lib/libvirt/images/os-u1404.img.00 

3>install cloud-init and update
启动镜像

virsh  start os-u1404
virsh console os-u1404

安装 cloud-init, 配置cloud-init去除掉不需要的监听服务,修改用户等等

apt-get install cloud-init
dpkg-reconfigure cloud-init

检查更改 /etc/cloud-init/cloud.conf
然后停机

shutdown -h now

4>Prepare for openstack image
清除掉数据以便可以运行到OpenStack环境中

virt-sysprep -d os-u1404

5>upload to glance and enjoy it

qemu-img convert -O raw os-u1404.img os-u1404-raw.img
glance image-create --name "os-u1404" --file os-u1404-raw.img --disk-format raw --container-format bare --is-public True --progress
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值