Created
April 19, 2013 22:25
-
-
Save cwolferh/5423642 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # quickly bring up a Fedora 18 image. root on host OS should be able | |
| # to ssh into the guest without a password. | |
| # assumption: libvirtd already running | |
| sudo sh -c "cd /var/lib/libvirt/images/ | |
| if [ ! -f Fedora18-Cloud-x86_64-20130115.qcow2 ]; then | |
| wget http://mattdm.fedorapeople.org/cloud-images/Fedora18-Cloud-x86_64-20130115.qcow2 | |
| else | |
| echo Fedora18-Cloud-x86_64-20130115.qcow2 already present. | |
| fi | |
| " | |
| sudo virsh dominfo f18cloud >/dev/null 2>&1 | |
| if [ $? -eq 0 ]; then | |
| echo f18cloud already exists. exiting | |
| exit 0 | |
| fi | |
| sudo virt-install --connect qemu:///system --ram 1024 -n f18cloud -r 2048 --os-type=linux --os-variant=fedora18 --disk path=/var/lib/libvirt/images/Fedora18-Cloud-x86_64-20130115.qcow2,device=disk,bus=virtio,format=qcow2 --vcpus=2 --vnc --noautoconsole --import | |
| sudo virsh destroy f18cloud | |
| sleep 10 | |
| sudo sh -c "if [ ! -f /root/.ssh/id_rsa.pub ]; then ssh-keygen -t rsa -N '' -f /root/.ssh/id_rsa ; fi" | |
| sudo mkdir -p /mnt/f18cloud | |
| sudo guestmount -a /var/lib/libvirt/images/Fedora18-Cloud-x86_64-20130115.qcow2 -i /mnt/f18cloud | |
| sudo cp -f /root/.ssh/id_rsa.pub /mnt/f18cloud/root/.ssh/authorized_keys | |
| sudo umount /mnt/f18cloud | |
| sleep 10 | |
| sudo virsh start f18cloud |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment