1cdbb44856
Change-Id: Ib8795703e3a812a0cc7a681a78380e53b3f0e689 Closes-bug: #1304100
2.4 KiB
2.4 KiB
We have CentOS 6.4 and 6.5 cloud images. Recommended is CentOS 6.5 (http://sahara-files.mirantis.com/CentOS-6.5-cloud-init.qcow2).
Prepare your own CentOS cloud image:
- Create disk image with qcow2 format
qemu-img create -f qcow2 -o preallocation=metadata /tmp/centos-6-cloud.qcow2 2G
- Install CentOS, You should use one partition and no swap. Get netinstall ISO from http://isoredirect.centos.org/centos/6/isos/x86_64/.
virt-install --name=centos-6-cloud --disk path=/tmp/centos-6-cloud.qcow2,format=qcow2 -r 1024 --vcpus=1 --hvm -c /tmp/CentOS-6.5-x86_64-netinstall.iso
- Login into your new image and modify '/etc/sysconfig/network-scripts/ifcfg-eth0' to look like this
DEVICE="eth0"
BOOTPROTO="dhcp"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
- Add EPEL repository and update OS
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
- Install cloud-utils and cloud-init
yum install cloud-utils, cloud-init
- Download 'centos-image-mod.sh' and 'init-part' together in same directory, run 'centos-image-mod.sh'. This will modify initrd and grub.conf.
git clone https://github.com/jaryn/centos-image-resize
cd centos-image-resize && ./centos-image-mod.sh
6.1. Edit '/boot/grub/grub.conf', check if everything is OK. Also, may not be a bad idea to set timeout to 0.
- Delete '/etc/udev/rules.d/70-persistent-net.rules', this will be auto created during boot. Don't forget this, since you won't have functional network when you bring this image up on Openstack.
- Check files:
File '/etc/cloud/cloud.cfg' should contain these lines:
default_user:
name: cloud-user
lock_passwd: true
gecos: CentOS Cloud User
groups: [wheel, adm]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
Add them if they are not exist.
File '/etc/fstab'. Check that fifth and sixth fields contain value '0'.
- Power down your virtual Centos
- Compress qcow2 image with
qemu-img convert -c /tmp/centos-6-cloud.qcow2 -O qcow2 /tmp/centos.qcow2
Image /tmp/centos.qcow2 is now ready for upload to Openstack