Installing Libvirt / QEMU for KVM Virtualization on #Slackware
Hello friends!
Today is 2016/08/25, 25 years of Linux! Happy Birthday!! :D :D
Today we gonna talk about how to install Libvirt and QEMU to use KVM Virtualization systems. To do that you can use many strategies here we will use just the official slackware package management tool (slackpkg) and some of “unofficial” scripts from Slackbuilds (if you dont know how to use and install Slackbuilds please see the post How I build and install almost every package in my slackware linux) to install Libvirt.
First, dont forget to enable your Virtualization in BIOS
Some BIOS come to the user with the Virtualization disabled by default, to check in your Linux if you has the support for virtualization just type this:
$ egrep --color '(vmx|smx)' /proc/cpuinfo
If you doesn’t see any ouput then you need to enable Virtualization in BIOS! If you can’t find any “Virtualization” there then perhaps you don’t have Virtualization support in your CPU :(
Installing Libvirt to use KVM virtualization
Download the lastest slackbuids scripts and then go to libvirt and build
# git clone git://slackbuilds.org/slackbuilds.git
# cd slackbuilds/libraries/libvirt
# source *info; wget -c $DOWNLOAD; sh *SlackBuild
The basic packages for you mount your virtualization server are libvirt and qemu but for a graphical manager you could also install the virt-manager software, this script helps you build all that you need to get these packages in .t?z format and install with installpkg.
Now, I don’t know how you choice your packages, so if you see something like this during the build of Libvirt, this is what you need to do:
- error #1 (first try this)
configure: error: You must install the pciaccess module to build with udev Don’t panic! Just browse the official packages with slackpkg like that
# slackpkg search pciaccess
[uninstalled] - libpciaccess-0.13.4-x86_61-1
# slackpkg install libpciaccess
- error #2 (second, try the slackbuild)
configure: error: You must install the libyajl library & headers to compile libvirt No panic again! Just install the dependencies and repeat the process until there is no other package
# find ~/slackbuilds -iname '*yajl*'
/root/slackbuilds/libraries/yajl
# cd ~/slackbuilds/libraries/yajl
# source *info; wget -c $DOWNLOAD; sh *SlackBuild
# installpkg /tmp/yajl*
And done! If you install all the dependencies you should now have a libvirt.txz** and **qemut?z packages into your /tmp directory and you just need to install they using installpkg.
Starting your Libvirt daemon to run your VM guests
Slackware still uses runlevels scripts into /etc/rc.d directory so to start libvirt you need to do
# sh /etc/rc.d/rc.libvirt start
Starting virtlockd: /usr/sbin/virtlockd -d
Starting virtlogd: /usr/sbin/virtlogd -d
Starting libvirtd: /usr/sbin/libvirtd -d
To enable this in boot
# chmod u+x /etc/rc.d/rc.libvirt
# echo '/etc/rc.d/rc.libvirt start' >> /etc/rc.d/rc.local
See my slackware VM guest in action
# virsh list
Id Name State
----------------------------------------------------
1 slack64-srv01 running
And that’s it for now! Wait for my new article soon: KVM Virtualization with command line. Hope you enjoy it! :)