KARR, DAVID
2015-Jul-09 18:48 UTC
Re: [libvirt-users] libvirt beginner needs to create and start VMs entirely on command line
Thanks for replying. Good info so far. After I start the VM, I’m going to need to see the boot console, and I’ll need to ssh into it with a hostname or IP. What are some required steps for those needs? This VM is going to need to access a few associated networks. I can see that the “—networks” option is part of the interface for configuring this. What are some things I’ll have to do for this? From: Jeff Tchang [mailto:jeff.tchang@gmail.com] Sent: Thursday, July 09, 2015 11:21 AM To: KARR, DAVID Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] libvirt beginner needs to create and start VMs entirely on command line I actually find I do almost all my VM management inside the virsh command. If the VM appears to exist inside virsh but is in a shut off state then you should try to start it. VNC can also be SSH port forwarded (which I have done before). Not sure if this will help but this is the command I use to create VMs: virt-install \ --name example \ --vcpus=4 \ --disk /data/example,size=80 \ --ram 2048 \ --graphics vnc,password=**********,listen=0.0.0.0,port=15916 \ --accelerate \ --cdrom /var/kvm/ubuntu-14.04.1-server-amd64-autoinstall.iso \ --os-type=linux \ --noautoconsole \ --network network=default \ --boot cdrom,fd,hd,network,menu=off I also edit the XML file sometimes. Notice I have the autoinstall iso. Basically I went through and created a ks.cfg file after extracting the ISO file to a directory. Then I ran a command like this: mkisofs -D -r -V "auto install" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat<http://boot.cat> -no-emul-boot -boot-load-size 4 -boot-info-table -o /var/kvm/ubuntu-14.04.1-server-amd64-autoinstall.iso /root/serveriso On Thu, Jul 9, 2015 at 10:57 AM, KARR, DAVID <dk068x@att.com<mailto:dk068x@att.com>> 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. _______________________________________________ libvirt-users mailing list libvirt-users@redhat.com<mailto:libvirt-users@redhat.com> https://www.redhat.com/mailman/listinfo/libvirt-users
Jeff Tchang
2015-Jul-09 20:53 UTC
Re: [libvirt-users] libvirt beginner needs to create and start VMs entirely on command line
To see the boot console you need to have a VNC client and connect to it
once it is up.
For Mac OS I use the "Screen Sharing" application which can connect to
VNC
natively.
For Windows you can use something like tightvnc.
For SSH you need to make sure it is listening on the port.
--network is used to specify a libvirt network I believe.
On my example box it is in /var/lib/libvirt/network/default.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made
using:
virsh net-edit default
or other application using the libvirt API.
-->
<networkstatus>
<class_id bitmap='0-2'/>
<floor sum='0'/>
<network>
<name>default</name>
<uuid>*****</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='****'/>
<ip address='192.168.5.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.5.100' end='192.168.5.254'/>
<host mac='aa:bb:cc:dd:dd:dd' name='example-reserved'
ip='192.168.5.10'/>
</dhcp>
</ip>
</network>
</networkstatus>
So basically you do --network default and then make sure the VM is
configured to do a DHCP out and it will get an address.
virsh net-edit default is the command you want to run.
There is also a command to view the networks that libvirt has.
On Thu, Jul 9, 2015 at 11:48 AM, KARR, DAVID <dk068x@att.com> wrote:
> Thanks for replying. Good info so far.
>
>
>
> After I start the VM, I’m going to need to see the boot console, and I’ll
> need to ssh into it with a hostname or IP. What are some required steps
> for those needs?
>
>
>
> This VM is going to need to access a few associated networks. I can see
> that the “—networks” option is part of the interface for configuring
> this. What are some things I’ll have to do for this?
>
>
>
> *From:* Jeff Tchang [mailto:jeff.tchang@gmail.com]
> *Sent:* Thursday, July 09, 2015 11:21 AM
> *To:* KARR, DAVID
> *Cc:* libvirt-users@redhat.com
> *Subject:* Re: [libvirt-users] libvirt beginner needs to create and start
> VMs entirely on command line
>
>
>
> I actually find I do almost all my VM management inside the virsh command.
>
> If the VM appears to exist inside virsh but is in a shut off state then
> you should try to start it.
>
>
>
> VNC can also be SSH port forwarded (which I have done before).
>
>
>
> Not sure if this will help but this is the command I use to create VMs:
>
>
>
> virt-install \
>
> --name example \
>
> --vcpus=4 \
>
> --disk /data/example,size=80 \
>
> --ram 2048 \
>
> --graphics vnc,password=**********,listen=0.0.0.0,port=15916 \
>
> --accelerate \
>
> --cdrom /var/kvm/ubuntu-14.04.1-server-amd64-autoinstall.iso \
>
> --os-type=linux \
>
> --noautoconsole \
>
> --network network=default \
>
> --boot cdrom,fd,hd,network,menu=off
>
>
>
> I also edit the XML file sometimes. Notice I have the autoinstall iso.
> Basically I went through and created a ks.cfg file after extracting the ISO
> file to a directory. Then I ran a command like this:
>
> mkisofs -D -r -V "auto install" -cache-inodes -J -l -b
> isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size
> 4 -boot-info-table -o /var/kvm/ubuntu-14.04.1-server-amd64-autoinstall.iso
> /root/serveriso
>
>
>
>
>
> On Thu, Jul 9, 2015 at 10:57 AM, KARR, DAVID <dk068x@att.com> 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.
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>
>
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>
KARR, DAVID
2015-Jul-10 18:37 UTC
Re: [libvirt-users] libvirt beginner needs to create and start VMs entirely on command line
This is offtopic, but related to what you’ve told me so far. I’m having some
trouble getting the VNC connection to work. Technically, the “connection” is
working fine, but the Windows TightVNC Viewer comes up with an error dialog
saying this:
Xsession: unable to start X session --- no "/home/.../.xsession" file,
no
"/home/.../.Xsession" file, no session managers, no window managers,
and no
terminal emulators found; aborting.
The ~/.xsession-errors file on the remote box says the same thing (so that
confirms my port forwarding is working), and I definitely do NOT have a
~/.xsession file, so the error message is definitely accurate. I obviously need
to get a .xsession file, but I’m not sure if the absence of that file implies
something more “high-level”. I’m vaguely familiar with what goes into
.xsession, although I haven’t worked with X11 for ~25 years or so.
From: Jeff Tchang [mailto:jeff.tchang@gmail.com]
Sent: Thursday, July 09, 2015 1:53 PM
To: KARR, DAVID
Cc: libvirt-users@redhat.com
Subject: Re: [libvirt-users] libvirt beginner needs to create and start VMs
entirely on command line
To see the boot console you need to have a VNC client and connect to it once it
is up.
For Mac OS I use the "Screen Sharing" application which can connect to
VNC natively.
For Windows you can use something like tightvnc.
For SSH you need to make sure it is listening on the port.
--network is used to specify a libvirt network I believe.
On my example box it is in /var/lib/libvirt/network/default.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh net-edit default
or other application using the libvirt API.
-->
<networkstatus>
<class_id bitmap='0-2'/>
<floor sum='0'/>
<network>
<name>default</name>
<uuid>*****</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='****'/>
<ip address='192.168.5.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.5.100' end='192.168.5.254'/>
<host mac='aa:bb:cc:dd:dd:dd' name='example-reserved'
ip='192.168.5.10'/>
</dhcp>
</ip>
</network>
</networkstatus>
So basically you do --network default and then make sure the VM is configured to
do a DHCP out and it will get an address.
virsh net-edit default is the command you want to run.
There is also a command to view the networks that libvirt has.
On Thu, Jul 9, 2015 at 11:48 AM, KARR, DAVID
<dk068x@att.com<mailto:dk068x@att.com>> wrote:
Thanks for replying. Good info so far.
After I start the VM, I’m going to need to see the boot console, and I’ll need
to ssh into it with a hostname or IP. What are some required steps for those
needs?
This VM is going to need to access a few associated networks. I can see that
the “—networks” option is part of the interface for configuring this. What are
some things I’ll have to do for this?
From: Jeff Tchang
[mailto:jeff.tchang@gmail.com<mailto:jeff.tchang@gmail.com>]
Sent: Thursday, July 09, 2015 11:21 AM
To: KARR, DAVID
Cc: libvirt-users@redhat.com<mailto:libvirt-users@redhat.com>
Subject: Re: [libvirt-users] libvirt beginner needs to create and start VMs
entirely on command line
I actually find I do almost all my VM management inside the virsh command.
If the VM appears to exist inside virsh but is in a shut off state then you
should try to start it.
VNC can also be SSH port forwarded (which I have done before).
Not sure if this will help but this is the command I use to create VMs:
virt-install \
--name example \
--vcpus=4 \
--disk /data/example,size=80 \
--ram 2048 \
--graphics vnc,password=**********,listen=0.0.0.0,port=15916 \
--accelerate \
--cdrom /var/kvm/ubuntu-14.04.1-server-amd64-autoinstall.iso \
--os-type=linux \
--noautoconsole \
--network network=default \
--boot cdrom,fd,hd,network,menu=off
I also edit the XML file sometimes. Notice I have the autoinstall iso. Basically
I went through and created a ks.cfg file after extracting the ISO file to a
directory. Then I ran a command like this:
mkisofs -D -r -V "auto install" -cache-inodes -J -l -b
isolinux/isolinux.bin -c isolinux/boot.cat<http://boot.cat> -no-emul-boot
-boot-load-size 4 -boot-info-table -o
/var/kvm/ubuntu-14.04.1-server-amd64-autoinstall.iso /root/serveriso
On Thu, Jul 9, 2015 at 10:57 AM, KARR, DAVID
<dk068x@att.com<mailto:dk068x@att.com>> 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.
_______________________________________________
libvirt-users mailing list
libvirt-users@redhat.com<mailto:libvirt-users@redhat.com>
https://www.redhat.com/mailman/listinfo/libvirt-users
_______________________________________________
libvirt-users mailing list
libvirt-users@redhat.com<mailto:libvirt-users@redhat.com>
https://www.redhat.com/mailman/listinfo/libvirt-users
Reasonably Related Threads
- Re: libvirt beginner needs to create and start VMs entirely on command line
- Re: libvirt beginner needs to create and start VMs entirely on command line
- Re: libvirt beginner needs to create and start VMs entirely on command line
- Re: libvirt beginner needs to create and start VMs entirely on command line
- Re: libvirt beginner needs to create and start VMs entirely on command line