记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

WebVirtMgr

 WebVirtMgr

Setting up the server to work with the service

 

ContOS, Fedora, RedHat

Install packages libvirt-bin, KVM

# yum -y install kvm libvirt

 

Ubuntu, Debian

Install packages libvirt-bin, KVM, sasl2-bin

$ sudo apt-get install kvm libvirt-bin sasl2-bin

 

ContOS, Fedora, RedHat

Uncomment the line in the file /etc/sysconfig/libvirtd

LIBVIRTD_ARGS="--listen"

 

Ubuntu, Debian

Add the option -l in the file /etc/default/libvirt-bin

libvirtd_opts="-d -l"

 

Ubuntu, Debian, Fedora, CentOS, RedHat

The file /etc/libvirt/libvirtd.conf uncomment the line

listen_tls = 0
listen_tcp = 1

 

ContOS, Fedora, RedHat

Start the daemon libvirtd

# service libvirtd start

 

Ubuntu, Debian

Restart the daemon libvirtd, because after installation it runs automatically

$ sudo service libvirt-bin restart

 

Adding users and setting their passwords is done with the saslpasswd2 command. When running this command it is important to tell it that the appname is libvirt. As an example, to add a user fred, run

 

ContOS, Fedora, RedHat

# saslpasswd2 -a libvirt fred
Password: xxxxxx
Again (for verification): xxxxxx

 

Ubuntu, Debian

$ sudo saslpasswd2 -a libvirt fred
Password: xxxxxx
Again (for verification): xxxxxx

 

To see a list of all accounts the sasldblistusers2 command can be used. This command expects to be given the path to the libvirt user database, which is kept in/etc/libvirt/passwd.db

 

ContOS, Fedora, RedHat

# sasldblistusers2 -f /etc/libvirt/passwd.db
fred@webvirtmgr.net: userPassword

 

Ubuntu, Debian

$ sudo sasldblistusers2 -f /etc/libvirt/passwd.db
fred@webvirtmgr.net: userPassword

 

To disable a user's access, use the command saslpasswd2 with the -d

 

ContOS, Fedora, RedHat

# saslpasswd2 -a libvirt -d fred

 

Ubuntu, Debian

$ sudo saslpasswd2 -a libvirt -d fred

 

Configuring the firewall

 

ContOS, Fedora, RedHat

Open access to ports libvirt

# iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 16509 -j ACCEPT

 

Ubuntu, Debian

Create a file /etc/ufw/applications.d/libvirtd and it add the following lines

[Libvirt]
title=Virtualization library
description=Open port for WebVirtMgr
ports=16509/tcp

Add a firewall rule in the chain

$ sudo ufw allow from any to any app Libvirt

 

Test connection

Before you add the ip address of your server in the control center perform the following test

$ virsh -c qemu+tcp://IP_address/system nodeinfo
Please enter your authentication name: fred
Please enter your password: xxxxxx
CPU model:           x86_64
CPU(s):              2
CPU frequency:       2611 MHz
CPU socket(s):       1
Core(s) per socket:  2
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         2019260 kB

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):