KVM is a virtual machine under CentOS, a useful virtualization technology, but usually the server runs CentOS rarely installs the graphical interface, the use of commands to manage the virtual machine is also troublesome, so there is a Web-based virtualization management platform is very convenient.
Installation environment, Centos7.3, hardware Dell r710,3 block 1TB HDD do array 5
Installing the KVM Section
1, first, the server BIOS to turn on virtualization support,
Then, see if the server CPU supports virtualization, the general server will support it, and you can see the supported
[Email protected] ~]# egrep ' (svm|vmx) '/proc/cpuinfo
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/191ec04b9e6850b71fe37c0e5471ae0a.png-wh_500x0-wm_3 -wmp_4-s_1035969757.png "title=" 1.png "alt=" 191ec04b9e6850b71fe37c0e5471ae0a.png-wh_ "/>
2. Turn off SELinux and set selinux=disabled
[[email protected] ~]# vim /etc/selinux/config
# this file controls the state of selinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - no selinux policy is loaded. selinux=disabled# selinuxtype= can take one of three two values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only Selected processes are protected. # mls - multi level security protection. Selinuxtype=targeted
3. Final installation of KVM
[email protected] ~]# Yum install QEMU-KVM libvirt virt-install bridge-utils-y
Set boot up
[Email protected] ~]# systemctl enable libvirtd.service [[email protected] ~]# systemctl start Libvirtd.service
4. Configure the NIC bridge so that the KVM virtual machine can use the physical computer network segment
Edit the physical NIC
[Email protected] network-scripts]# vim ifcfg-em1
Bridge=br0 #增加这段br0是桥接网卡名字BOOTPROTO =nonedefroute=yespeerdns=yespeerroutes=yesipv4_failure_fatal=noipv6init= Yesipv6_autoconf=yesipv6_defroute=yesipv6_peerdns=yesipv6_peerroutes=yesipv6_failure_fatal=noipv6_addr_gen_ Mode=stable-privacyname=em1uuid=db488d6c-f2bd-4162-91b0-b093da627043device=em1onboot=yes #设置网卡启用
Copy an EM1 configuration file and rename it to Br0
[email protected] network-scripts]# CP ifcfg-em1 IFCFG-BR0
Type=bridge #增加这段BOOTPROTO =nonedefroute=yespeerdns=yespeerroutes=yesipv4_failure_fatal=noipv6init=yesipv6_ Autoconf=yesipv6_defroute=yesipv6_peerdns=yesipv6_peerroutes=yesipv6_failure_fatal=noipv6_addr_gen_mode= Stable-privacyname=br0 #名字改成br0DEVICE =br0 #名字改成br0ONBOOT =yes #设置网卡启用IPADDR =192.168.30.4 #设置IP, this is a physical machine ipnetmask=255.255.255.0gateway=192.168.30.1dns1=8.8.8.8
Configuration complete Restart NIC, configuration successful
[[Email protected] network-scripts]# ifconfig br0: flags=4163<up,broadcast,running , multicast> mtu 1500 inet 192.168.30.4 netmask 255.255.255.0 broadcast 192.168.30.255 inet6 fe80::97ef:e8ee:ec13:7b67 prefixlen 64 scopeid 0x20<link> ether 00:24:e8:79:5f:9a txqueuelen 1000 (Ethernet) rx packets 94700 bytes 38161377 (36.3&NBSP;MIB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 52912 bytes 24224444 (23.1 &NBSP;MIB) &NBSP;&NBSP;&NBSP;&Nbsp; tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0em1: flags=4163<up,broadcast,running,multicast> mtu 1500 ether 00:24:e8:79:5f:9a txqueuelen 1000 (Ethernet) rx packets 115799 bytes 70980112 (67.6&NBSP;MIB) RX errors 0 dropped 6 overruns 0 frame 0 TX packets 74826 bytes 26101223 (24.8 &NBSP;MIB) tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The KVM section is basically done here.
Webvirtmgr Installation Section
1. Install dependent packages
Yum-y install git python-pip libvirt-python libxml2-python python-websockify python-develpip Install NumPy
2. Download the program code WEBVIRTMGR
[[Email protected]]# git clone git://github.com/retspen/webvirtmgr.git #clone代码 [[Email protected]]# MV webvirtmgr/ /var/www/#移动到/var/www directory [[email protected] ~]# Cd/var/www/webvirtmgr/[[email protected] We bvirtmgr]# pip Install-r requirements.txt #安装依赖
Initializing the database, configuring the administrative user
[[Email protected] webvirtmgr]# ./manage.py syncdbwarning:root:no local_settings file found. CREATING&NBSP;TABLES&NBSP, ..... Creating table auth_permissioncreating table auth_group_permissionscreating table auth_groupcreating table auth_user_groupscreating table auth_user_user_ Permissionscreating table auth_usercreating table django_content_typecreating table django_sessionCreating table django_siteCreating table servers_computeCreating Table instance_instancecreating table create_flavoryou just installed django ' s auth system, which means you don ' t have any superusers Defined. would you like to create one now? (yes/no): yesUsername (leave blank to use ' root '): root #管理账号Email address: Password: #管理密码Password (again): superuser created successfully. INSTALLING&NBSP;CUSTOM&NBSP;SQL&NBSP, ..... INSTALLING&NBSP;INDEXES&NBSP, ..... Installed 6 object (s) from 1 fixture (s)
Next, choose Yes
[[Email protected] webvirtmgr]# ./manage.py collectstaticwarning:root:no local_ Settings file found. you have requested to collect static files at the Destinationlocation as specified in your settings. this will overwrite existing files! Are you sure you want to do this? type ' yes ' to continue, or ' no ' to cancel: yesCopying '/var/www/ Webvirtmgr/webvirtmgr/static/css/bootstrap-multiselect.css ' copying '/var/www/webvirtmgr/webvirtmgr/static /css/bootstrap.min.css ' copying '/var/www/webvirtmgr/webvirtmgr/static/css/signin.css ' Copying '/var/ Www/webvirtmgr/webvirtmgr/static/css/table-sort.css ' copying '/var/www/webvirtmgr/webvirtmgr/static/css/ Webvirtmgr.css ' copying '/var/www/webvirtmgr/webvirtmgr/static/fonts/glyphicons-halflings-regular.eot ' copying '/var/www/webvirtmGr/webvirtmgr/static/fonts/glyphicons-halflings-regular.svg ' copying '/var/www/webvirtmgr/webvirtmgr/ Static/fonts/glyphicons-halflings-regular.ttf ' copying '/var/www/webvirtmgr/webvirtmgr/static/fonts/ Glyphicons-halflings-regular.woff ' copying '/var/www/webvirtmgr/webvirtmgr/static/img/asc.gif '
Add additional administrative users, choose to do
[Email protected] webvirtmgr]#/manage.py Createsuperuser
3, configuration Nginx, installation Nginx process slightly
Configure the virtual host site as follows
Server { listen 80 default_server; server_name $hostname; access_log /var/log/nginx/webvirtmgr_access_log; location /static/ { root /var/ www/webvirtmgr/webvirtmgr; 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; }}
and start the Nginx.
4. Start Webvirtmgr program and Webvirtmgr-console
nohup/usr/bin/python/var/www/webvirtmgr/manage.py Run_gunicorn 127.0.0.1:8000 & nohup/usr/bin/python/var/www/ Webvirtmgr/console/webvirtmgr-console &
Firewall section
Firewall-cmd--permanent--add-port=80/tcp firewall-cmd--permanent--add-port=6080/tcp firewall-cmd--permanent- -add-port=5900/tcp firewall-cmd--permanent--add-port=5901/tcp #控制台端口, can be more #开放几个5900起 Firewall-cmd--reload
Open the Admin interface,
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/14/b3fedbe84a39df9007edc5248898a44a.png-wh_500x0-wm_3 -wmp_4-s_395784030.png "title=" 2.png "alt=" B3fedbe84a39df9007edc5248898a44a.png-wh_ "/>
Webvirtmgr Management Section
1, landing up, need to add the managed host, here is empty, we want to add the managed KVM host is this machine, as long as SSH password-free login can
[Email protected] ~]# ssh-keygen-t rsa[[email protected] ~]# Ssh-copy-id 192.168.30.4
Login is empty by default
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/14/3e4510fd4cf38386767cc434a7e3c858.png-wh_500x0-wm_3 -wmp_4-s_3848897378.png "title=" 3.png "alt=" 3e4510fd4cf38386767cc434a7e3c858.png-wh_ "/>
Add connection, select SSH connection
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/9cac2cf3cbce7b3773d26a9e7cbef455.png-wh_500x0-wm_3 -wmp_4-s_1670049591.png "style=" Float:none; "title=" 4.png "alt=" 9cac2cf3cbce7b3773d26a9e7cbef455.png-wh_ "/>
Added success is here, I have created a virtual machine here
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/14/6c6c93f4c2f91ba90630c6924e4fbc41.png-wh_500x0-wm_3 -wmp_4-s_3151072728.png "title=" 5.png "alt=" 6c6c93f4c2f91ba90630c6924e4fbc41.png-wh_ "/>
Before creating a virtual machine we need to create a storage pool, that is, the virtual machine disk storage location
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/4c2def3006f9175b0d4cc0cb80b858c7.png-wh_500x0-wm_3 -wmp_4-s_2122662582.png "title=" 8.png "alt=" 4c2def3006f9175b0d4cc0cb80b858c7.png-wh_ "/>
Create a Catalog type volume
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/844a9f1f6f1af6f0324471b096d97d7d.png-wh_500x0-wm_3 -wmp_4-s_235389183.png "title=" 9.png "alt=" 844a9f1f6f1af6f0324471b096d97d7d.png-wh_ "/>
Add an ISO mirrored volume, install the disk image and put it here.
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/14/fab73c4ac35fb251346e6a1108f57b33.png-wh_500x0-wm_3 -wmp_4-s_2537423559.png "title=" 10.png "alt=" Fab73c4ac35fb251346e6a1108f57b33.png-wh_ "/>
This is the network Interface section, and the bridge port Br0 I created earlier is shown here.
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/14/8efa953156386f679481be9be6d46731.png-wh_500x0-wm_3 -wmp_4-s_1120233552.png "title=" 7.png "alt=" 8efa953156386f679481be9be6d46731.png-wh_ "/>
Then create a network pool called offices.
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/14/b0f1f6f429d2bbff0394c484833950aa.png-wh_500x0-wm_3 -wmp_4-s_1672033943.png "title=" 11.png "alt=" B0f1f6f429d2bbff0394c484833950aa.png-wh_ "/>
The creation is complete.
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/14/16bf82284b491ad44a52ec84217b5066.png-wh_500x0-wm_3 -wmp_4-s_4040120894.png "title=" 6.png "alt=" 16bf82284b491ad44a52ec84217b5066.png-wh_ "/>
Let's go to the storage pool and give us a 50G disk for the virtual machine we want to create.
Click Storage Pool To add the image, note that metadata will really create a 50G file
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/14/c9d583b7d59aea822b16aa5b3ade62c2.png-wh_500x0-wm_3 -wmp_4-s_2073881408.png "title=" 12.png "alt=" C9d583b7d59aea822b16aa5b3ade62c2.png-wh_ "/>
Create complete
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/c83a50f3eb08534b17abd49857f16fef.png-wh_500x0-wm_3 -wmp_4-s_995769164.png "title=" 13.png "alt=" C83a50f3eb08534b17abd49857f16fef.png-wh_ "/>
Next you can create a virtual machine, select Newinstance
Note that the temple here is useless, click on the custom instance
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/14/f0c6354da26632c3cfed1dfe4484f6e2.png-wh_500x0-wm_3 -wmp_4-s_625621469.png "title=" 14.png "alt=" F0c6354da26632c3cfed1dfe4484f6e2.png-wh_ "/>
Main settings name, CPU, memory, and the disk image you just created hugw.img and network pool offices bridging
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/14/5fc9b84e746a413a0b098aeac9e0e777.png-wh_500x0-wm_3 -wmp_4-s_760817793.png "style=" Float:none; "title=" 15.png "alt=" 5fc9b84e746a413a0b098aeac9e0e777.png-wh_ "/>
Click on the virtual machine name to access the management after the creation is complete
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/42391623cb9b02b8d8426d1e21cb6eef.png-wh_500x0-wm_3 -wmp_4-s_2003196891.png "style=" Float:none; "title=" 16.png "alt=" 42391623cb9b02b8d8426d1e21cb6eef.png-wh_ "/>
This is the connection console.
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/14/ae38bc99327401bda28192fb4eee25a9.png-wh_500x0-wm_3 -wmp_4-s_653492829.png "style=" Float:none; "title=" 17.png "alt=" Ae38bc99327401bda28192fb4eee25a9.png-wh_ "/>
Here Select the installation disk ISO, when installing the system if you are not prompted to find the installation media here point to connect on the line
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/6a1cb9f462d415dd8bacd483b9f3bfcf.png-wh_500x0-wm_3 -wmp_4-s_919072445.png "style=" Float:none; "title=" 18.png "alt=" 6a1cb9f462d415dd8bacd483b9f3bfcf.png-wh_ "/>
Boot up, click on the re-installation system, you can properly manage the virtual machine
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/14/7843da4b5a99472aad914eb1a5bd0442.png-wh_500x0-wm_3 -wmp_4-s_1271156140.png "title=" 19.png "alt=" 7843da4b5a99472aad914eb1a5bd0442.png-wh_ "/>
By this end
This article is from the "Flying Love Story" blog, please be sure to keep this source http://niubdada.blog.51cto.com/3511133/1981760
Webvirtmgr Centos7.3-based KVM Virtualization management platform Installation