{"id":210,"date":"2017-09-05T15:37:45","date_gmt":"2017-09-05T15:37:45","guid":{"rendered":"http:\/\/info.ffteixeira.net\/2017\/09\/05\/fedora-libvirt-family-tools-for-virtualization-solution\/"},"modified":"2017-09-05T15:37:45","modified_gmt":"2017-09-05T15:37:45","slug":"fedora-libvirt-family-tools-for-virtualization-solution","status":"publish","type":"post","link":"https:\/\/blog.ffteixeira.net\/?p=210","title":{"rendered":"Fedora libvirt family tools for virtualization solution"},"content":{"rendered":"<h2><span class=\"mw-headline\" id=\"Fedora_22_to_current:\">Fedora 22 to current: <\/span><\/h2>\n<p>For Fedora 21 or previous installations, replace &quot;dnf&quot; with &quot;yum.&quot; Yum is now a deprecated package manager and is replaced by DNF on installations of Fedora 22 and onward.<\/p>\n<pre>\nsu -c &quot;dnf install @virtualization&quot;\n<\/pre>\n<p>This will install below Mandatory and Default packages.<\/p>\n<pre>\n$ <strong>dnf groupinfo virtualization<\/strong>\n\nGroup: Virtualisation\n Group-Id: virtualization\n Description: These packages provide a virtualisation environment.\n Mandatory Packages:\n   =virt-install\n Default Packages:\n   =libvirt-daemon-config-network\n   =libvirt-daemon-kvm\n   =qemu-kvm\n   =virt-manager\n   =virt-viewer\n Optional Packages:\n   guestfs-browser\n   libguestfs-tools\n   python-libguestfs\n   virt-top\n<\/pre>\n<p>This will install Mandatory, Default and Optional Packages.<\/p>\n<pre>\n<strong>su -c &quot;dnf group install with-optional virtualization&quot;\n<\/strong><\/pre>\n<p>To start the service:<\/p>\n<pre>\n<strong>su -c &quot;systemctl start libvirtd&quot;\n<\/strong><\/pre>\n<p>To start the service on boot:<\/p>\n<pre>\n<strong>su -c &quot;systemctl enable libvirtd&quot;\n<\/strong><\/pre>\n<p>Verify that the kvm kernel modules were properly loaded:<\/p>\n<pre>\n$ lsmod | grep kvm\nkvm_amd                55563  0 \nkvm                   419458  1 kvm_amd\n<\/pre>\n<p>If that command did not list kvm_intel or kvm_amd, KVM is not properly configured. See <a href=\"\/wiki\/How_to_debug_Virtualization_problems#Ensuring_system_is_KVM_capable\" title=\"How to debug Virtualization problems\"> Ensuring system is KVM capable<\/a> for troubleshooting tips.<\/p>\n<h3><span class=\"mw-headline\" id=\"Networking_Support\">Networking Support <\/span><\/h3>\n<p>By default libvirt will create a private network for your guests on the host machine. This private network will use a 192.168.x.x subnet and not be reachable directly from the network the host machine is on, but virtual guests can use the host machine as a gateway and can connect out via it. If you need to provide services on your guests that are reachable via other machines on your host network you can use iptables DNAT rules to forward in specific ports, or you can setup a Bridged env.<\/p>\n<h3><span class=\"mw-headline\" id=\"Creating_a_Fedora_guest\">Creating a Fedora guest <\/span><\/h3>\n<p>The installation of Fedora guests using anaconda is supported. The installation can be started on the command line via the <code>virt-install<\/code> program or in the GUI program <code>virt-manager<\/code>.<\/p>\n<h4><span class=\"mw-headline\" id=\"Creating_a_guest_with_virt-install\">Creating a guest with virt-install <\/span><\/h4>\n<p><code>virt-install<\/code> is a command line based tool for creating virtualized guests. Refer to <a class=\"external free\" href=\"http:\/\/virt-tools.org\/learning\/install-with-command-line\/\">http:\/\/virt-tools.org\/learning\/install-with-command-line\/<\/a> for understanding how to use this tool. Execute <code>virt-install --help<\/code> for command line help.<\/p>\n<p><code>virt-install<\/code> can use kickstart files, for example <code>virt-install -x ks=kickstart-file-name.ks<\/code>.<\/p>\n<p>If graphics were enabled, a VNC window will open and present the graphical installer. If graphics were not enabled, a text installer will appear. Proceed with the fedora installation.<\/p>\n<h4><span class=\"mw-headline\" id=\"Creating_a_guest_with_virt-manager\">Creating a guest with virt-manager <\/span><\/h4>\n<p>Start the GUI Virtual Machine Manager by selecting it from the &quot;Applications&#8211;&gt;System Tools&quot; menu, or by running the following command:<\/p>\n<pre>\nsu -c &quot;virt-manager&quot;\n<\/pre>\n<p>If you encounter an error along the lines of &quot;Failed to contact configuration server; some possible causes are that you need to enable TCP\/IP networking for ORBit, or you have stale NFS locks due to a system crash&quot;, trying running <code>virt-manager<\/code> not as root (without the <code>su -c<\/code>). The GUI will prompt for the root password.<\/p>\n<ol>\n<li>Open a connection to a hypervisor by choosing File&#8211;&gt;Add connection&#8230;<\/li>\n<li>Choose &quot;qemu&quot; for KVM, or &quot;Xen&quot; for Xen.<\/li>\n<li>Choose &quot;local&quot; or select a method to connect to a remote hypervisor<\/li>\n<li>After a connection is opened, click the new icon next to the hypervisor, or right click on the active hypervisor and select &quot;New&quot; (Note &#8211; the new icon is going to be improved to make it easier to see)<\/li>\n<li>A wizard will present the same questions as appear with the <code>virt-install<\/code> command-line utility (see descriptions above). The wizard assumes that a graphical installation is desired and does not prompt for this option.<\/li>\n<li>On the last page of the wizard there is a &quot;Finish&quot; button. When this is clicked, the guest OS is provisioned. After a few moments a VNC window should appear. Proceed with the installation as normal.<\/li>\n<\/ol>\n<p><strong><span class=\"mw-headline\" id=\"Managing_guests_with_virsh\">Managing guests with virsh <\/span><\/strong><\/p>\n<p>The <code>virsh<\/code> command line utility that allows you to manage virtual machines. Guests can be managed on the command line with the <code>virsh<\/code> utility. The <code>virsh<\/code> utility is built around the libvirt management APIl:<\/p>\n<ul>\n<li><code>virsh<\/code> has a stable set of commands whose syntax and semantics are preserved across updates to the underlying virtualization platform.<\/li>\n<li><code>virsh<\/code> can be used as an unprivileged user for read-only operations (e.g. listing domains, listing domain statistics).<\/li>\n<li><code>virsh<\/code> can manage domains running under Xen, Qemu\/KVM, esx or other backends with no perceptible difference to the user<\/li>\n<\/ul>\n<p>To start a virtual machine:<\/p>\n<pre>\nsu -c &quot;virsh create &lt;name of virtual machine&gt;&quot;\n<\/pre>\n<p>To list the virtual machines currently running:<\/p>\n<pre>\nsu -c &quot;virsh list&quot;\n<\/pre>\n<p>To list all virtual machines, running or not:<\/p>\n<pre>\nsu -c &quot;virsh list --all&quot;\n<\/pre>\n<p>To gracefully power off a guest:<\/p>\n<pre>\nsu -c &quot;virsh shutdown &lt;virtual machine (name | id | uuid)&gt;&quot;\n<\/pre>\n<p>To non gracefully power off a guest:<\/p>\n<pre>\nsu -c &quot;virsh destroy &lt;virtual machine (name | id | uuid)&gt;&quot;\n<\/pre>\n<p>To save a snapshot of the machine to a file:<\/p>\n<pre>\nsu -c &quot;virsh save &lt;virtual machine (name | id | uuid)&gt; &lt;filename&gt;&quot;\n<\/pre>\n<p>To restore a previously saved snapshot:<\/p>\n<pre>\nsu -c &quot;virsh restore &lt;filename&gt;&quot;\n<\/pre>\n<p>To export the configuration file of a virtual machine:<\/p>\n<pre>\nsu -c &quot;virsh dumpxml &lt;virtual machine (name | id | uuid)&quot;\n<\/pre>\n<p>For a complete list of commands available for use with <code>virsh<\/code>:<\/p>\n<pre>\nsu -c &quot;virsh help&quot;\n<\/pre>\n<p><a href=\"https:\/\/fedoraproject.org\/wiki\/Getting_started_with_virtualization#Installing_and_configuring_Fedora_For_virtualized_guests\" target=\"_blank\" rel=\"noopener noreferrer\">Credits<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fedora 22 to current: For Fedora 21 or previous installations, replace &quot;dnf&quot; with &quot;yum.&quot; Yum is now a deprecated package manager and is replaced by DNF on installations of Fedora 22 and onward. su -c &quot;dnf install @virtualization&quot; This will &hellip; <a href=\"https:\/\/blog.ffteixeira.net\/?p=210\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14,21,44,45],"class_list":["post-210","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-fedora","tag-kvm","tag-virt-manager","tag-virtualization"],"_links":{"self":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/posts\/210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210"}],"version-history":[{"count":0,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}