Created
May 14, 2018 17:33
-
-
Save shettyg/455ff78605ea4c45febe7b5aa345c87d to your computer and use it in GitHub Desktop.
Ubuntu cloud images and virt-manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* How to create a Ubuntu VM on your local Ubuntu KVM from Ubuntu cloud images. | |
1. Get the ubuntu cloud image (.img file from) | |
mkdir temp; cd temp; | |
wget http://cloud-images.ubuntu.com/trusty/20140101.55/trusty-server-cloudimg-amd64-disk1.img | |
2. Create a file "seed" | |
cat seed | |
#cloud-config | |
password: passw0rd | |
chpasswd: { expire: False } | |
ssh_pwauth: True | |
ssh_import_id: kirkland # what is this? kirkland comes from the blog I copied this from | |
3. Create a "seed.img" from the above | |
cloud-localds seed.img seed | |
4. sudo cp trusty-server-cloudimg-amd64-disk1.img /var/lib/libvirt/images/ | |
5. sudo cp seed.img /var/lib/libvirt/images/ | |
sudo apt-get install virt-manager -y | |
6. tell libvirt to re-scan for new files | |
virsh pool-refresh default | |
7. Create a copy of your img. | |
sudo virsh vol-clone --pool default trusty-server-cloudimg-amd64-disk1.img test.img | |
virsh pool-refresh default | |
8. sudo virt-manager | |
a) New -> Give a name | |
b) Choose "local install media" (iso or cdrom) | |
c) Locate your install media -> "use iso image" -> "seed.img" | |
d) select mem and cpu. | |
e) enable storage for this VM -> choose existing storage -> test.img | |
finish | |
9. username: ubuntu ; password = passw0rd | |
10. After a reboot, the seed.img is no longer in cdrom, so you will not be able to login | |
So you need to edit the VM config to add a CDROM and then add seed.img in it. | |
This will makesure that a reboot will let you login. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IMO this one is much more straightforward:
https://www.surlyjake.com/blog/2020/10/09/ubuntu-cloud-images-in-libvirt-and-virt-manager/