Ubuntu Image

Follow instruction at Open Stack Ubuntu Image Example

Virt Setup

On host server. Create qcow2 image.

qemu-img create -f qcow2 /vms/openstack/ubuntu-trusty.qcow2 5G

Download installation image iso.

curl -o ubuntu-trusty-1404-mini.iso http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/mini.iso

Start Installation process.

virt-install --virt-type kvm --name trusty --ram 1024 --cdrom=/vms/openstack/ubuntu-trusty-1404-mini.iso --disk=/vms/openstack/ubuntu-trusty.qcow2,format=qcow2 --network network=default --graphics vnc,listen=0.0.0.0 --noautoconsole --os-type=linux

The test host machine is at CentOS 6. It has an old virt-install. The following variant option is not available. Therefore ignored.

--os-variant ubuntutrusty

OS Installation

This installation expose console through vnc. When installing virtual machine from cdrom, -x or --xargs option is not available. Therefore text mode console is not enabled. The installation procedure completed in vnc graphic console.

Default user settings

  • User name: ubuntu
  • Password: ubuntu

Virtual machine in OpenStack use growpart to grow partition size when bigger disk size selected in instance configuration. However this Ubuntu version uses an old version growpart. It can not handle LVM partition successfully. This installation then use raw partitions. It also has difficulty when root partition is followed by other partitions. Therefore this installation use manually partitioning to assign the last partition to /.

Start installing packages.

  1. No automatic updates.
  2. Add OpenSSH Server
  3. Install Grub

Reboot, actually shutdown.

Eject CDROM

Identify cdrom device name. In this example the name of cdrom device is hdc.

virsh dumpxml trusty

In virsh console on host machine. Eject disk from hdc

# virsh start trusty --paused
# virsh attach-disk --type cdrom --mode readonly trusty "" hdc
# virsh resume trusty

Install and Configure Cloud-Init

Access console using vncviewer. Login as ubuntu and sudo to root.

Install cloud-init

# apt-get install cloud-init

Reconfigure cloud-init. Leave only EC2 data source selected. Otherwise, it take long time to start instance in openstack.

# dpkg-reconfigure cloud-init

Install whois for mkpasswd command

# apt-get install whois

Create password for default user. Save password text to a temporary file. Cannot copy pate with mouse in vncviewer.

# mkpasswd --method=SHA-512 --rounds=4096 | tee /tmp/pass.txt

Update default_user section in /etc/cloud/cloud.cfg.

  1. change name from ubuntu to clouduser
  2. change gecos to Cloud User
  3. change lock_passwd to False
  4. add attribute passwd to this user using :r command to load password text from temporary file

Edit /etc/ssh/sshd_config to allow root user login

  1. change PermitRootLogin from without-password to yes

Set root password on command line with passwd

Shut down server

# shutdown -h now

copy qcow2 image file, in case need redo/modify image configuration.

Clean Image File

Clean up image. For example, clear MAC, bash history.

# virt-sysprep -d trusty

Upload Image to Glance

Copy to cloud server.

scp /vms/openstack/ubuntu-trusty.qcow2 icloud.ccs.miami.edu:/data/images-to-upload/ubuntu-trusty.qcow2

Upload image to glance

glance image-create --name 'Ubuntu-trusty-x86_64'  --file /data/images-to-upload/ubuntu-trusty.qcow2 --disk-format qcow2   --container bare --visibility public --progress

results matching ""

    No results matching ""