apt-get install libvirt-bin virtinst cloud-img-utils
Download the Ubuntu cloud image from Ubuntu's official site: https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
Create a new QEMU disk image named athena-test.img
in the qcow2
format using the cloud image as a backing file.
qemu-img create -f qcow2 -b trusty-server-cloudimg-amd64-disk1.img athena-test.img
The default image is almost 2 GB, so you can enlarge the disk image. Thanks to thin provisioning, it will not actually cause the size of the disk image to increase until more files have been written to it. Let's give it 8 more gigabytes:
qemu-img resize athena-test.img +8G
A cloud "seed" image can used by cloud-init
to configure the machine.
It requires a meta-data
file and a user-data
file.
Examples of each have been provided in this gist.
If you're using the default settings, simply run
cloud-localds athena-test-seed.iso user-data.yaml meta-data.yaml
First, copy the cloud images to their final destination.
Assuming /var/lib/libvirt/images
is where the default pool is
sudo cp athena-test.img athena-test-seed.iso /var/lib/libvirt/images
Then, you're ready to create the virtual machine!
virt-install -n athena-test \
--memory 1024 --vcpus 2 \
--cpu host-model-only \
--clock offset=utc \
--import \
--os-variant ubuntu14.04 \
--disk vol=default/athena-test.img \
--disk vol=default/athena-test-seed.iso,device=cdrom \
--network default \
--graphics none
You should see the machine being created, with its serial console presented to you. In the messages that flash by, you should see lines like
Set the following 'random' passwords
ubuntu:rAnDomPass
When the login screen is finally presented to you, login as user ubuntu
with the indicated random password.
Then, immediately use passwd
to change it to something more secure.
On your host machine, run
virsh net-dhcp-leases default
to find out the locally assigned IP address of your machine
Then, try running
ssh ubuntu@[the ip address]
to log in as the user ubuntu.
If you're able to log in, then congratulations!
You have completed the install, and cloud-init
did its job correctly.
https://sipb.mit.edu/doc/kerberized-server/
fail2ban
orsshguard