Installation and use of web management tool wok for KVM

I. overview

kvm has no web management page. When using kvm virtualization, it usually needs to rely on other management systems or command-line mode, which brings great inconvenience to small-scale use of kvm, while wok is very convenient and lightweight to use kimchi to manage kvm

Based on cherrypy's web framework, Wok can be extended by some plug-ins, such as virtualization management, host management and system management. It can run in any HTML 5 enabled web browser

Kimchi is a KVM management tool based on HTML5. It is a plug-in of wok (you must install wok before using kimchi). It is more convenient to manage KVM through kimchi

2, Installation and use

# Turn off SELinux and firewall
sed -i 's/\(SELINUX=\).*/\1disabled/g' /etc/selinux/config
setenforce 0

systemctl stop firewalld 
systemctl disable firewalld

2.1 installation of kvm

# install
yum install kvm libvirt -y
# Configure the bridge network card. Please set the specific network card name and IP address according to the actual environment
cat > /etc/sysconfig/network-scripts/ifcfg-br0 <<EOF

cat > /etc/sysconfig/network-scripts/ifcfg-em1 <<EOF

# Restart network service
# Please stop or uninstall the NetworkManager service if the GUI is installed
systemctl restart network
# Start libvirt
systemctl start libvirtd
systemctl enable libvirtd

2.2. Install wok and plug-in

# Download page
# wok
# kimchi
# Download the rpm package of the corresponding platform on the project releases page

# install
yum install epel-release -y
yum localinstall *.rpm -y
# Start wok
systemctl daemon-reload
systemctl start wokd
systemctl enable wokd
# When wokd is started, nginx will start automatically. If selinux is not closed, nginx will not start

2.3 visit wok

#After installation, nginx will listen to port 8001
 #Open https://IP:8001 in browser
 #The account password of the login page is the account password of the operating system, which can be logged in by the root user on the system

2.4 configure wok network

#After the installation, the default network is nat mode. Set the bridging network according to the requirements. Above, we have created at least one bridging interface, which needs to be added to the wok for use
 #Set the following in the web page

As shown in the above figure, the operation is successful.

2.5 storage settings

As shown in the figure above, the default directory for storing iso image and the location for storing virtual machine image are shown in the figure above. If the available space of the default / directory is limited, we need to modify it to the partition with large storage space. As follows, we need to modify it to / data/isos and / data/images

# The configuration of libvirt needs to be modified here
# Create directory
mkdir -pv /data/{images,isos}
cd /etc/libvirt/storage
# You can see that there are two files corresponding to default.xml iso.xml, as shown in the figure above
vim default.xml
# Others remain unchanged
vim ISO.xml

# Restart libvirtd
systemctl restart libvirtd
# Refresh the next page

As shown in the figure above, the modification is successful. Of course, you can also click the "add memory" button to add

2.6 use of formwork

There are two types of templates, one is iso template, the other is image file of installed system

iso template is usually used to install operating system or mount CD-ROM

Image template can create a batch of virtual machines quickly

The iso template will not be described in detail. Here is how to customize the image template, as follows

#The so-called customized template means that different templates are customized according to the requirements of the system environment of the company or individual
 #Case 1: for example, a company's business is all running on tomcat, and the system installation and environment configuration are frequent. In order to save the administrator's time, we need to customize a system template for running Tomcat programs

#Case 2: there are many system environments in a company, such as tomcat, nginx, redis, memcached, etc. How to do it? It's very simple to do more templates. In this way, you can save many days after you spend a day doing templates. Why not do something once and for all
#The customized template needs to be on a machine with kvm and a graphical interface, create a virtual machine and install the desired system
 #Then according to their own needs to optimize the system, install and configure some customized software
 #Then delete uuid and mac address in the network card configuration file
 #Finally, remove rm -rf /etc/udev/rules.d/*
To shut down
 #Finally, copy the image file of this virtual machine to a directory on the target host, and then add the corresponding image file path in the template to use

Tags: Linux network SELinux github RPM

Posted on Sun, 22 Mar 2020 12:14:47 -0400 by spikeon