WebVirtMGR

Need a simple and easy to use Free KVM Manager? While there are many tools out there that offer similar functionality I found that with only a few hosts WebVirtMgr offers a simple and easy UI to create and manage Hypervisors and VM’s.

Outline of setting up WebVirtMgr

  • Prepare CentOS 7.3 Server
  • Prepare CentOS 7.3 Client
  • Install and configure WebVirtMgr on Server
  • Install and configure WebVirtMgr on each Client
  • Test Connectivity between Client and Server

Server Setup

Prepare the CentOS 7 server
https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr

After a new CentOS 7.3 Server with security disabled

You may need to update current epel-release
yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
yum -y install gcc python-devel

After running above command update pip and install numpy
pip install --upgrade pip
pip install numpy

clone webvirtmgr from github and install it
git clone git://github.com/retspen/webvirtmgr.git
cd webvirtmgr
pip install -r requirements.txt
./manage.py syncdb
./manage.py collectstatic

Move the webvirtmgr directory from root to /var/www
mkdir /var/www
cd ../
mv webvirtmgr /var/www/

Edit the webvirtmgr.conf file and add the following content
vi /etc/nginx/conf.d/webvirtmgr.conf

server {
listen 80 default_server;

server_name $hostname;
access_log /var/log/nginx/webvirtmgr_access_log;

location /static/ {
root /var/www/webvirtmgr/webvirtmgr; # or /srv instead of /var
expires max;
}

location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
client_max_body_size 1024M; # Set higher depending on your needs
}
}

comment out the http section as seen below
vi /etc/nginx/nginx.conf

# server {
# listen 80 default_server;
# listen [::]:80 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }

Restart nginx
service nginx restart

Add webvirtmgr to startup
/usr/sbin/setsebool httpd_can_network_connect true
chkconfig supervisord on

Change user permissions on webvirtmgr and all content within
chown -R nginx:nginx /var/www/webvirtmgr

Add/Change the following information within the webvirtmgr.ini file
vi /etc/supervisord.d/webvirtmgr.ini

[program:webvirtmgr]
command=/usr/bin/python /var/www/webvirtmgr/manage.py run_gunicorn -c /var/www/webvirtmgr/conf/gunicorn.conf.py
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
logfile=/var/log/supervisor/webvirtmgr.log
log_stderr=true
user=nginx

[program:webvirtmgr-console]
command=/usr/bin/python /var/www/webvirtmgr/console/webvirtmgr-console
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-console.log
redirect_stderr=true
user=nginx

Restart supervisord
systemctl restart supervisord

Test webvirtmgr
cd /var/www/webvirtmgr
git pull

Client Setup

Install packages libvirt-bin, KVM
yum -y install qemu-kvm libvirt

Uncomment the line starting with LIBVIRTD_ARGS
vi /etc/sysconfig/libvirtd

LIBVIRTD_ARGS="--listen"

Uncomment the following lines
vi /etc/libvirt/libvirtd.conf

listen_tls = 0
listen_tcp = 1

Start libvirtd
systemctl restart libvirtd

Adding user and set password
saslpasswd2 -a libvirt virtmgr
Password: webvirtmgr
Again (for verification): webvirtmgr

To see a list of all accounts the sasldblistusers2 the following command can be used
sasldblistusers2 -f /etc/libvirt/passwd.db

Configuring the firewall (only required if iptables is enabled)
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 16509 -j ACCEPT

Test connection (from Manager)
virsh -c qemu+tcp://localhost/system nodeinfo
Please enter your authentication name: virtmgr
Please enter your password: webvirtmgr
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

May need to utilize domain name to connect…
virsh -c qemu+tcp://localhost/system nodeinfo
Please enter your authentication name: webvirtmgr@localhost

Check to ensure ports are opened
netstat -lntp | grep libvirtd
tcp 0 0 0.0.0.0:16509 0.0.0.0:* LISTEN 19643/libvirtd
tcp6 0 0 :::16509 :::* LISTEN 19643/libvirtd



Categories: network services

Tags: , , ,

2 replies

  1. Reblogged this on Tricky Deadline and commented:
    Great tool to manage your KVM instances. Thanks Scott!

    Like

  2. Reblogged this on ✄ Geeky Snippets ✄ and commented:
    I have been using Web Virt Manager for a year, it is faster than using “Virt Manager” with X-forwarding from my mac.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: