The following steps is used to create VMM image from Centos Cloud Image.
- By default it doesn't have any password. During the first boot, cloud-init will try to retrieve the configuration (which may include password and ssh-key). In the openstack environment, cloud-init is provided by openstack infrastructure.
- If cloud-init failed to retrieve the configuration, the VM will boot with random password.
- Configuration to the cloud-init, can also be provided through CDROM image attached to the VM during the first boot. Inside the CDROM image must have the configuration files required by cloud init, including password. How to create this CDROM seed image can be found here
- To simplify the process, I have created the seed CDROM image, where the password for default user (userid : centos) is set to
mysecret
- Download Centos cloud Image from centos image
- Copy the files to file with new name, for example
centos80g.img
and resize the image accordingly - By default, the centos cloud image size is 8G, to change the size, use the command
qemu-img resize <image_file> <new_size>
- Download the seed cdrom image, and put it on the same directory as the previous image.
- Create VMM configuration file, with the following content :
[irzan@q-pod13-vmm make_image]$ cat centosmake.conf
#include "/vmm/bin/common.defs"
#define INSTALL_DISK bootdisk_rw "/vmm/data/user_disks/irzan/make_image/centos80g.img";
#define CDROM_BOOT cdrom_boot "/vmm/data/user_disks/irzan/make_image/seed.img";
config "make1" {
vm "centos1" {
hostname "centos1";
INSTALL_DISK
CDROM_BOOT
ncpus 2;
memory 4096;
setvar "+qemu_args" "-cpu qemu64,+vmx";
interface "em0" { bridge "private1"; };
};
PRIVATE_BRIDGES
};
[irzan@q-pod13-vmm make_image]$
- Enable the config and start the topology
- Get the serial and vga_display information of the VM, to access the console
- Access the serial console, and you may have since there is no dhcp server
- Once the booting process is done, you can login into the system using username/password : centos/mysecret
- Do
sudo bash
to access as admin user the do the following
- change the password for user
centos
- change the password for user
root
- remove
cloud-init
application from the system
- On centos7, a new naming scheme for network interface is introduced. Instead of using
eth
, it uses the driver name for the network interface name. - To revert back to the legacy naming of interfaces like
eth0
,eth1
,eth2
, etc, then additional parameter need to be added during kernel boot process, and this is done by modifying the grub configuration file which will be read during the boot-up process. - Edit file /etc/default/grub and add net.ifnames=0 biosdevname=0 to line GRUB_CMDLINE_LINUX
- Run command
grub2-mkconfig
to generate new grub configuration file - Shutdown the VM , stop and unbind it on the VMM
- Move the image file into your repository so it can be used