I am using another reference to do this, which can be found below.
http://www.server-world.info/en/note?os=CentOS_7&p=kvm
Ok. After I followed these instructions, I had to locate another site:
http://www.itzgeek.com/how-tos/linux/centos-how-tos/install-kvm-qemu-on-centos-7-rhel-7.html
So basically, step 1 is to install the necessary packages. Using BOTH of these sites, I came up with the following list:
- qemu-kvm = QEMU emulator
- qemu-img = QEMU disk image manager
- virt-install = Command line tool to create virtual machines.
- libvirt = Provides libvirtd daemon that manages virtual machines and controls hypervisor.
- libvirt-install = Provides libvirtd daemon that manages virtual machines and controls hypervisor.
- bridge-utils = creating bridges, et al.
- libvirt-client = provides client side API’s for accessing servers and also provides virsh utility which provides command line tool to manage virtual machines.
- virt-viewer – Graphical console
So I installed these using yum -y (assume yes) ...packages...
Next, step 2, is to create a bridge that will be used to allow the VMs inside the KVM to reach the NIC on the box to communicate with outside networks.
Actually, because I already have a bridge interface (br0), I am going to try to use that rather than creating a bridge.
Next, I need to connect to the KVM host. I don't have X on this machine, so I will need to connect from another CentOS 7 box that does have X installed. On that box, which has X and Gnome Desktop, I installed libvirt, libvirt-client, and virt-viewer.
But - I ran into a problem connecting.
After debugging, I realized the KVM host does not accept inbound SSH connections as root. So I tried to connect as a different user that is in the wheel group, and this did not work either.
I think the answer to that is in this blog here, which involves policy set up.
http://wiki.libvirt.org/page/SSHPolicyKitSetup
This in fact did not work either, so I instead did this:
https://goldmann.pl/blog/2012/12/03/configuring-polkit-in-fedora-18-to-access-virt-manager/
This in fact did not work either, so I instead did this:
https://goldmann.pl/blog/2012/12/03/configuring-polkit-in-fedora-18-to-access-virt-manager/
polkit.addRule(function(action, subject) { if (action.id == "org.libvirt.unix.manage" && subject.local && subject.active && subject.isInGroup("wheel")) { return polkit.Result.YES; } });
But I took the subject.local out, because I was connecting from a remote machine.
next, on the other CentOS 7 device I was connecting to the KVM host from (which is also a CentOS 7 VM on Virtual Box), we ran the following commands so that we wouldn't get repeatedly authenticated.
ssh-keygen (accept defaults)
ssh-copy-id [ kvm host address ]
UPDATE:
I finally got a server with 32 Gb RAM to use as a KVM host. I decided NOT to put XWindows on this host, and use it, truly, just as a host. I set up a virt-manager on another VirtualBox Linux VM, and figured I would use that to interact with the host.
I had a devil of a time getting the darn VMs to install.
Finally, I realized that the secret, was to pass in some extra-args on the command line. I realized this on a web discussion, which I would have liked to have posted here, but unfortunately I could not relocate that discussion. Also, I had to change cdrom to "location". Once I did this, I was able to see standard console output on the install.
#!/usr/bin/bash
virt-install \
-n CentOS7-KVM1 \
--description "KVM1 CentOS7" \
--os-type=Linux \
--os-variant=centOS7.0 \
--ram=2048 \
--vcpus=2 \
--disk path=/home/kvm/images/vDisk0.img,bus=virtio,size=10 \
--graphics none \
--location /var/tmp/CentOS-7-x86_64-Minimal-1511.iso \
--network bridge:virbr0 \
--extra-args "console=tty0 console=ttyS0,115200n8 serial"
next, on the other CentOS 7 device I was connecting to the KVM host from (which is also a CentOS 7 VM on Virtual Box), we ran the following commands so that we wouldn't get repeatedly authenticated.
ssh-keygen (accept defaults)
ssh-copy-id [ kvm host address ]
UPDATE:
I finally got a server with 32 Gb RAM to use as a KVM host. I decided NOT to put XWindows on this host, and use it, truly, just as a host. I set up a virt-manager on another VirtualBox Linux VM, and figured I would use that to interact with the host.
I had a devil of a time getting the darn VMs to install.
Finally, I realized that the secret, was to pass in some extra-args on the command line. I realized this on a web discussion, which I would have liked to have posted here, but unfortunately I could not relocate that discussion. Also, I had to change cdrom to "location". Once I did this, I was able to see standard console output on the install.
#!/usr/bin/bash
virt-install \
-n CentOS7-KVM1 \
--description "KVM1 CentOS7" \
--os-type=Linux \
--os-variant=centOS7.0 \
--ram=2048 \
--vcpus=2 \
--disk path=/home/kvm/images/vDisk0.img,bus=virtio,size=10 \
--graphics none \
--location /var/tmp/CentOS-7-x86_64-Minimal-1511.iso \
--network bridge:virbr0 \
--extra-args "console=tty0 console=ttyS0,115200n8 serial"
1 comment:
I want to installing kvm on centos 7 and your blog is very helpful for me. Thanks for sharing
Post a Comment