[libvirt-users] libvirt beginner needs to create and start VMs entirely on command line

Aaron Bruelisauer aaron.bruelisauer at tuor.org
Fri Jul 10 06:12:21 UTC 2015


On 07/09/2015 07:57 PM, KARR, DAVID wrote:
> I'm a beginner to libvirt and creating VMs, for that matter.  I have a set of specifications for VMs I need to create and log into, but I have to create them on an Ubuntu box that I only have ssh access to.  I won't have desktop GUI access, although I do have dynamic port forwarding, so I can access a browser GUI from my desktop.
> 
> Reading through the libvirt info, I see numerous mentions about using VNC to do additional work, but I won't be able to use VNC (not allowed within our firewall).
> 
> I could use some advice on how to move forward with this.  I've started at https://help.ubuntu.com/lts/serverguide/libvirt.html for initial information.
> 
> I managed to create a disk image for my first VM, and I believe I created the first VM using an ISO (based on CentOS, I believe), but I'll probably have to rebuild that, because I think I have to configure networks on the VM, which I didn't do on initial creation.  I was confused by the initial results from "virt-install", because it seemed to hang after a second or two (I posted this SO question about this: http://stackoverflow.com/questions/31302871/trouble-using-virt-install-on-ubuntu-to-create-vm-just-hangs-after-displaying ).  The reply from this makes it seem like it was trying to present a GUI for next steps, but I of course never saw that.  The VM appears to exist, but in a "shut off" state.

You will need for your VM:
- a storage
- CPU
- memory
- display (ex: vnc) or console

nice to have to:
- installation device (ex: mounted ISO) are network boot
- network (most time you need a network connection ;) )

I think reading the complete manpage for virt-install would be not to
bad. But some informations that I can give you befor:

you can connect virt-install, virsh, virt-viewer, virt-manager, ... over
ssh to your virtualistation host. My virtualisation host dont have any
graphics, i  have only a SSH connection and doing all over it. I use
virsh, virt-install and virtmanager. All works (tunneled) over SSH. For
this you only need to connect on the right way:
https://libvirt.org/remote.html
https://libvirt.org/uri.html

when you want to connect with for example virt-manager to your remote
libvirtd just write the right URI and you can connect only with an SSH
connection to it.

If you want to use virt-install and virsh, for virt-install there is a
good manual but for virsh I don't know a complete manual. But # virsh
help command   # should help to.

you need to describe how you want to connect to your vm. I don't know
the default which virt-install is taking but you can set it to vnc:
--graphics=vnc

When you don't have graphics where you are running virt-install then you
should add:
--noautoconsole

You can start virt-install on you local machine and just give the option:
--connect=driver[+transport]://[username@][hostname][:port]/[path]\[?extraparameters]

So I hope I could help and answer some questions.

Best Regards
Aaron




More information about the libvirt-users mailing list