KVM Setup



  • Ok so it seems there's a bit of confusion for how this is set up. On CentOS and Fedora workstations you don't need to do this because it's installed by default. For the servers it's just as easy.

    On CentOS just choose software and then virtualization host:

    0_1502146188845_software.png
    0_1502146200888_virt-host.png

    On Fedora under software choose headless virtualization:

    0_1502146216302_fedora.png

    That's literally all the steps needed to have a working KVM hypervisor. If you want a GUI to manage with then install Virt-Manager on your workstation:

    dnf install virt-manager
    

    or

    yum install virt-manager
    

    Then connect to your host:

    0_1502146361204_connection.png


  • Service Provider

    Or if you want to start from a minimal Fedora 25/26 install you can simply run these three commands.

    # This will install Mandatory, Default and Optional Packages:
    su -c "dnf group install with-optional virtualization"
    # To start the service:
    su -c "systemctl start libvirtd"
    # To start the service on boot:
    su -c "systemctl enable libvirtd"
    

    Source: https://fedoraproject.org/wiki/Getting_started_with_virtualization


  • Service Provider

    There is not a simple single command line choice for CentOS 7 after initial installation, but it is not difficult to follow any of the numerous guides on there on the subject.



  • @jaredbusch said in KVM Setup:

    There is not a simple single command line choice for CentOS 7 after initial installation, but it is not difficult to follow any of the numerous guides on there on the subject.

    there is :

    yum groupinstall Virtualization "Virtualization Platform" "Virtualization Tools"
    

    Right from minimal install.


  • Service Provider

    @emad-r said in KVM Setup:

    @jaredbusch said in KVM Setup:

    There is not a simple single command line choice for CentOS 7 after initial installation, but it is not difficult to follow any of the numerous guides on there on the subject.

    there is :

    yum groupinstall Virtualization "Virtualization Platform" "Virtualization Tools"

    Right from minimal install.

    My understanding of CentOS 7, as I have not used it for KVM, is that it subsequently needs some SELinux settings changed and then some networking setup.



  • @jaredbusch said in KVM Setup:

    @emad-r said in KVM Setup:

    @jaredbusch said in KVM Setup:

    There is not a simple single command line choice for CentOS 7 after initial installation, but it is not difficult to follow any of the numerous guides on there on the subject.

    there is :

    yum groupinstall Virtualization "Virtualization Platform" "Virtualization Tools"

    Right from minimal install.

    My understanding of CentOS 7, as I have not used it for KVM, is that it subsequently needs some SELinux settings changed and then some networking setup.

    Nope, nothing needed. you can use it with default selinux policy right from the start. And no changes to network either, however if you will use Ovirt, it does many changes to the network interfaces and it actually adds an interface maybe due to vsdm and not Ovirt persay,

    However back to your question, you can fully use Centos 7 KVM with selinux without any changes, you just need virt-manager setup on another machine (Fedora for example) and connect to your centos 7 KVM and install Windows 10, which I did for the past month or so for training purposes.


  • Service Provider

    @emad-r said in KVM Setup:

    @jaredbusch said in KVM Setup:

    @emad-r said in KVM Setup:

    @jaredbusch said in KVM Setup:

    There is not a simple single command line choice for CentOS 7 after initial installation, but it is not difficult to follow any of the numerous guides on there on the subject.

    there is :

    yum groupinstall Virtualization "Virtualization Platform" "Virtualization Tools"

    Right from minimal install.

    My understanding of CentOS 7, as I have not used it for KVM, is that it subsequently needs some SELinux settings changed and then some networking setup.

    Nope, nothing needed. you can use it with default selinux policy right from the start. And no changes to network either, however if you will use Ovirt, it does many changes to the network interfaces and it actually adds an interface maybe due to vsdm and not Ovirt persay,

    However back to your question, you can fully use Centos 7 KVM with selinux without any changes, you just need virt-manager setup on another machine (Fedora for example) and connect to your centos 7 KVM and install Windows 10, which I did for the past month or so for training purposes.

    Yes, that is how I use KVM now, just on Fedora 26. When I looked at setting up my first KVM test system, I looked at CentOS 7 and Fedora 25 and the official instructions for both. The CentOS wiki was much more complicated than the Fedora wiki.

    Also, as I stated in another thread, I pretty much gave up caring about the LTS nature of CentOS in today's world.



  • So I installed Fedora 26 and selected headless virtualization.

    When I connect to it from my Korora 25 workstation I get this warning:

    0_1502237653417_Screenshot from 2017-08-08 20-08-57.png

    virtualization was off in the BIOS....



  • @stacksofplates said in KVM Setup:

    On Fedora under software choose headless virtualization:

    0_1502146216302_fedora.png

    I installed F26 & KVM via Headless Virt.
    Same thing like I've done many times...

    From my F27 desktop, I can not connect (see image for error msg)
    Any ideas before I decide to reinstall F26?

    0_1512008371378_Screenshot from 2017-11-29 18-18-12.png



  • @fateknollogee said in KVM Setup:

    @stacksofplates said in KVM Setup:

    On Fedora under software choose headless virtualization:

    0_1502146216302_fedora.png

    I installed F26 & KVM via Headless Virt.
    Same thing like I've done many times...

    From my F27 desktop, I can not connect (see image for error msg)
    Any ideas before I decide to reinstall F26?

    0_1512008371378_Screenshot from 2017-11-29 18-18-12.png

    sudo dnf install openssh-askpass

    Or use ssh keys instead



  • @black3dynamite said in KVM Setup:

    sudo dnf install openssh-askpass

    Or use ssh keys instead

    Tried both of those, no difference, still get the error



  • @fateknollogee said in KVM Setup:

    @black3dynamite said in KVM Setup:

    sudo dnf install openssh-askpass

    Or use ssh keys instead

    Tried both of those, no difference, still get the error

    Are you connecting using root or your own login?
    Add yourself to libvirt group.



  • @black3dynamite said in KVM Setup:

    Are you connecting usinf root or your own login?
    Add yourself to libvirt group.

    Tried connecting as root & myself, no diff, still get the error
    Yes, I have added myself to the libvirt group.



  • All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?



  • @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)



  • @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    You can use putty to ssh into the server and then use virsh commands to manage VMs.

    You can setup a Fedora VM and use a light desktop environment or just a windows manager only to help with using less resources and then install virt-manager. That's the same way I would do it when I need to manage a Hyper-V host from Fedora or any other distros.



  • @black3dynamite said in KVM Setup:

    sudo dnf install openssh-askpass

    Or use ssh keys instead

    Ooops brain fart of the week...

    I wasn't paying attention, I installed openssh-askpass on the host instead of my workstation....(that was pretty stupid)
    All is good!!



  • @tim_g said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)

    Pretty much or running a Fedora VM. The command line tools are incredibly robust and very easy to learn.



  • @coliver said in KVM Setup:

    @tim_g said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)

    Pretty much or running a Fedora VM. The command line tools are incredibly robust and very easy to learn.

    Ansible has a libvirt module as well (http://docs.ansible.com/ansible/latest/virt_module.html). However it doesn't have clone because libvirt doesn't have a clone function. Virt-clone does a bunch of other work like snapshotting, copying, etc. And you can just run the commands with it like this simple setup here https://mangolassi.it/topic/15257/ansible-create-kvm-guests that builds a disk with virt-builder. By default the OS disks from virt-builder are really small (like 6GB), so you will need to add the logic in to create the second disk.



  • @stacksofplates said in KVM Setup:

    @coliver said in KVM Setup:

    @tim_g said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)

    Pretty much or running a Fedora VM. The command line tools are incredibly robust and very easy to learn.

    Ansible has a libvirt module as well (http://docs.ansible.com/ansible/latest/virt_module.html). However it doesn't have clone because libvirt doesn't have a clone function. Virt-clone does a bunch of other work like snapshotting, copying, etc. And you can just run the commands with it like this simple setup here https://mangolassi.it/topic/15257/ansible-create-kvm-guests that builds a disk with virt-builder. By default the OS disks from virt-builder are really small (like 6GB), so you will need to add the logic in to create the second disk.

    I really need to dig into Ansible. AWX as well could be really useful.



  • @coliver said in KVM Setup:

    @stacksofplates said in KVM Setup:

    @coliver said in KVM Setup:

    @tim_g said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)

    Pretty much or running a Fedora VM. The command line tools are incredibly robust and very easy to learn.

    Ansible has a libvirt module as well (http://docs.ansible.com/ansible/latest/virt_module.html). However it doesn't have clone because libvirt doesn't have a clone function. Virt-clone does a bunch of other work like snapshotting, copying, etc. And you can just run the commands with it like this simple setup here https://mangolassi.it/topic/15257/ansible-create-kvm-guests that builds a disk with virt-builder. By default the OS disks from virt-builder are really small (like 6GB), so you will need to add the logic in to create the second disk.

    I really need to dig into Ansible. AWX as well could be really useful.

    I run AWX at home and Tower at work. It's really amazing how easy it makes everything.



  • @tim_g said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)

    @black3dynamite said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    You can use putty to ssh into the server and then use virsh commands to manage VMs.

    You can setup a Fedora VM and use a light desktop environment or just a windows manager only to help with using less resources and then install virt-manager. That's the same way I would do it when I need to manage a Hyper-V host from Fedora or any other distros.

    Any GUI options?



  • @kelly said in KVM Setup:

    @tim_g said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    SSH (I like Putty)

    @black3dynamite said in KVM Setup:

    @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    You can use putty to ssh into the server and then use virsh commands to manage VMs.

    You can setup a Fedora VM and use a light desktop environment or just a windows manager only to help with using less resources and then install virt-manager. That's the same way I would do it when I need to manage a Hyper-V host from Fedora or any other distros.

    Any GUI options?

    Not on Windows no. There is Kimchi which does an ok job of managing VMs but it's clunky and not as powerful as Hyper-V Manager or vCenter.



  • @kelly said in KVM Setup:

    Any GUI options?

    As a heavy (in more ways than one) Windows user, I found installing Fedora in a VM was the eaiest way when I was playing with this.



  • It's the same in reverse too. How do you manage (via GUI) Hyper-V from Linux? You do it through a Win10 VM.

    How do you manage (via GUI) KVM from Windows? You do it through a Linux VM.

    That's really the easiest way to do it, without adding software to your hypervisors to be able to do it all via HTML5.



  • @tim_g said in KVM Setup:

    It's the same in reverse too. How do you manage (via GUI) Hyper-V from Linux? You do it through a Win10 VM.

    How do you manage (via GUI) KVM from Windows? You do it through a Linux VM.

    That's really the easiest way to do it, without adding software to your hypervisors to be able to do it all via HTML5.

    XenServer doesn't have to add software to the hypervisor.

    But I think I'm going to setup a basic lab at the office for this. I want to test it out, really I do.



  • @dustinb3403 said in KVM Setup:

    XenServer doesn't have to add software to the hypervisor.

    Neither does KVM. IMO KVM has always been so much easier to use than XenServer. No weird proprietary formats. No strange matching UUIDs of disks to UUIDs of VMs. It's just super easy overall.



  • @stacksofplates What is your distro of choice for running your Ansible "control machine?"



  • @bnrstnr said in KVM Setup:

    @stacksofplates What is your distro of choice for running your Ansible "control machine?"

    I use Fedora for AWX and Ansible core. For Tower, CentOS which is what they recommend.



  • @kelly said in KVM Setup:

    All scorn and derision aside, if I wanted to manage a KVM host from Windows what are my options?

    Any GUI options?

    How about testing either of the following two options if you dont want to have a linux vm or manage everything with virsh. Can't test them properly myself since currenty working out of my office and dont have any KVM server available:

    If you have Win 10

    1. WSL (Windows Subsystem for LInux) + VcXsrv+ virt-manger
      0_1512074930450_wsl-virtmanager.png

    If you have Win 7 you can use Cygwin

    1. Cygwin + virtmanager
      0_1512074998777_cygwin-virtmanager.png