Install libvirt in Ubuntu source code

Source: Internet
Author: User
Tags connect socket unix domain socket

 

Note: The test has passed in ubuntu12.04 and ubuntu14.04 respectively.

1. Installation of related packages

1) The official website to obtain the source code (http://www.libvirt.org/sources), the current version we use is 1.2.5

Wget http://libvirt.org/sources/libvirt-1.2.5.tar.gz

2) install some related packages before libvirt configuration and compilation (Note: you may need to update the source (SUDO apt-Get update) before installation; otherwise, the software package may not be properly installed)

Sudo apt-Get install qemu-KVM libvirt-bin bridge-utils

Sudo apt-Get install Ubuntu-VM-Builder

Sudo apt-Get install virt-Manager (optional) Restart Inst

Among them, qemu-KVM provides essential user space management tools for KVM. libvirt-bin provides libvirt API and virsh management tools. Bridge-utils provides brctl tools for managing bridges, ubuntu-VM-Builder provides a powerful command line tool for Ubuntu-optimized client construction. virt-manager provides a graphical interface for KVM management, virtinst provides a tool to install the client under the command line.

Sudo apt-Get install libvirt-dev libxml2 libxml2-dev gnutls-bin libneon27-gnutls libcurl4-gnutls-dev libnl-dev Python-dev libyajl-dev libdevmapper-dev libpciaccess-dev UUID-Dev

3) extract the obtained source code, tar-zxvf libvirt-1.2.5.tar.gz

Go to the source code Directory: CD libvirt-1.2.5

Configuration :. /configure (in the configuration process, the configuration may fail due to the lack of software packages required for compilation. In this case, you only need to install the corresponding software package as prompted and then run it again ". /configure command configuration .)

Compile: Make-J 4

Install: make install (the root permission is not required during configuration and compilation, but the root user permission is generally required for libvirt installation .)

Check the installed libvirt (if the following four commands can properly display the relevant directory and version information, the installation is successful ):

Which libmongod

Libmongod -- version

Which virsh

Virsh-version

Possible problemsQ1:Libmongod: Error while loading shared libraries: libivrt-lxc.so.0: cannot shared object file: no such file or directory

A1: modify the system dynamic link library configuration file. Method:

Go to the/etc/lD. So. conf. d directory.

新建命令:touch libvirt.conf
        赋权限:sudo chmod 666 /etc/ld.so.conf.d/libvirt.conf

Add a file libvirt. conf with the following content:

# Libvirt Default Configuration

/Usr/local/lib

Update the dynamic link library cache: sudo ldconfig

2. Environment Configuration

Libmongod. conf is the configuration file of libmongod, the daemon of libvirt. After modification, it takes effect only when libmongod is reloaded (or libmongod is restarted. The following configuration items indicate closing the TLS Security Authentication connection (which is enabled by default), opening the TCP connection (which is disabled by default), and setting the TCP listening port, TCP connections do not use authentication and authorization methods, and set the directory for saving Unix domain socket.

Sudo VI/usr/local/etc/libvirt/libjavasd. conf modify (configuration) the following options:

Listen_tls = 0

Listen_tcp = 1

Tcp_port = "16509"

Unix_sock_dir = "/var/run/libvirt"

Auth_tcp = "NONE"

3. Start libmongod

Sudo/usr/local/sbin/libmongod-D-l (Note: D represents daemon, l Represents listen)

View the startup result:

 

4. Actual operations

Sudo virsh list. If the following result is displayed, the installation and configuration are successful. You do not need to perform subsequent operations. Otherwise, you can continue to view the relevant error solution:

 

Possible problem Q2: failed to connect socket to '/var/local/var/run/libivrt-Sock': no such directory

A2: sudo ln-S/var/run/libvirt-Sock/usr/local/var/run/libvirt-sock

Q3: [Email protected]:/etc /#Sudo/usr/local/sbin/libmongod-D-l

Sudo: Unable to Resolve Host autotest0019

11:22:53. 319 + 0000: 31129: info: libvirt version: 1.2.5

11:22:53. 319 + 0000: 31129: Warning: virgethostname: 654: getaddrinfo failed for 'autotest0019 ': temporary failure in name resolution

/Usr/local/sbin/libmongod: Error: unable to obtain pidfile. Check/var/log/messages or run without -- daon for more info.

A3: Sudo VI/etc/hosts

Add one line: IP host name

Other possible problems:

Q4: [Email protected]:/etc/lD. So. conf. D #/usr/local/sbin/lib1_d-D-l

/Usr/local/sbin/libmongod: Error: unable to obtain pidfile. Check/var/log/messages or run without -- daemon for more info.

[Email protected]:/etc/lD. So. conf. D #/usr/local/sbin/lib1_d-l

11:27:37. 644 + 0000: 31256: info: libvirt version: 1.2.5

11:27:37. 644 + 0000: 31256: Error: virpidfileacquirepath: 414: failed to acquire PID File '/usr/local/var/run/libw.d. PID': Resource temporarily unavailable

A4: Edit/usr/local/var/run/libmongod. PID without modification. Then exit directly (it seems unreasonable ).

 

Install libvirt in Ubuntu source code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.