Git address: https://github.com/retspen/webvirtmgr
Environment:
system:centos6.2
libvirt:0.10.2
Webvirtmgr installation, reference: HTTPS://GITHUB.COM/RETSPEN/WEBVIRTMGR/WIKI/INSTALL-WEBVIRTMGR
1. Install the virtualized environment
-y‘Virtualization Tools‘-y‘Virtualization‘-y‘Virtulization Client‘-y‘Virtulization Platform‘
2. Installing dependent Packages
-y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm-y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
3. Cloning code
$ git clone git://github.com/retspen/webvirtmgr.git$ cd webvirtmgr$ sudo pip install -r requirements.txt# or python-pip (RedHat, Fedora, CentOS, OpenSuse)
Installing Django with PIP is not going well, error:
[[Email protected] ~]# pip install django==1.5.5
Collecting django==1.5.5
Could not find a version this satisfies the requirement django==1.5.5 (from versions:1.7plus-email-as-username-1.7.0, 4st ore-0.3, 503-0.1)
No matching distribution found for django==1.5.5
Toss for a long time, can only go to Django official website Download a django-1.5.12.tar.gz package to install
4.Django Environment Initialization
When executing SYNCDB, error, not installed MySQLdb
So download Mysql-python-1.2.5.zip, decompression installation, again an error: Command ' GCC ' failed with exit status 1
Reason is not installed: Mysql-devel,python-devel,mysql-python
$ ./manage.py syncdb$ ./manage.py collectstatic
5. Configure Nginx
Vim/etc/nginx/conf.d/webvirtmgr.conf content is as follows:
server {Listen theDefault_server; server_name$hostname;#access_log/var/log/nginx/webvirtmgr_access_log;location/static/{root/var/www/webvirtmgr/webvirtmgr;# or/srv instead Of/varExpires 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 -; Proxy_Read_timeout -; Proxy_send_timeout -; Client_max_body_size1024x768M# Set Higher depending on your needs}}
Comment out the default content of Nginx, vim/etc/nginx/conf.d/default.conf. and start the Nginx.
sudo service nginx restart
6. Start the Django
./manage.py runserver 0.0.0.0:8000
Access: http://x.x.x.x:8000 (x.x.x.x-your server IP address), enter the Django user and password created, if not created, use Python manager.py createsuperuser, Command creation. After logging in as shown
The Webvirtmgr client is set up, and the next step is to configure the host for the virtual machine, refer to git address: https://github.com/retspen/webvirtmgr/wiki/Setup-Host-Server
To Configure the host environment:
System:centos 6.6
libvirt:0.10.2
1. Download and execute the script: libvirt-bootstrap.sh
If the virtual machine is more numerous, the script will take longer to execute because service libvirt-guests restart will be executed and all running virtual machines will be suspended and then restored
curl http://retspen.github.io/libvirt-bootstrap.sh | sudo sh
2. Set up the firewall:
-I-m--NEW-m-p--16509-j ACCEPT
3. Setting up TCP authentication Setup TCP Authorization
Reference: Https://github.com/retspen/webvirtmgr/wiki/Setup-TCP-authorization,webvirtmgr need this account when creating a new server connection
sudo-a libvirt fredPassword: xxxxxxAgain (for verification): xxxxxx
View newly added accounts
sudo-f /etc/libvirt/passwd.db[email protected]: userPassword
To delete a new account:
sudo-a-d fred
Verify the new account number:
virsh-c qemu+tcp:// IP_ Address/system nodeinfoplease Enter your authentication name:fred @webvirtmgr . netplease Enter your password:xxxxxxcpu model:x86_64cpu (s ): 2 CPU Frequency: 2611 Mhzcpu socket (s ): 1 Core (s ) per socket : 2 Thread (s ) per core: 1 NUMA cell (s ): 1 Memory Size: 2019260
KB
Note: the full name of the account with hostname, such as [email protected]
4. Set up SSH authentication
SSH and TCP settings A can, in fact, is to set no password login, to be aware of what users from the Webvirtmgr to the host of what the user's no password login, such as I run with the root of the Django Webvirtmgr, and host is the root run Virsh, So you need to set root-to-root login without password. and the GIT website recommended is to use Nginx user run Django Webvirtmgr,webvirtmgr user run Virsh, so set is Nginx user to host Webvirtmgr user's no password login.
Reference: Https://github.com/retspen/webvirtmgr/wiki/Setup-SSH-Authorization
5. Connect to the server using TCP authentication
Access: HTTP://XXXX:8000,XXXX is the IP address of webvirtmgr, click New Connection
Use TCP connection, label fill IP address, FQDN/IP fill in the IP address, user name fill in the third step to set up the TCP authentication add account, here the user name does not add @hostname, click Add Complete. Such as:
6. Connect to the server using SSH authentication
Access: http://xxxx:8000,xxxx is webvirtmgr IP address, click on new connection, using SSH authentication involves a problem, such as I use the account webvirtmgr login host, but use the command Virsh List, the virtual machine information cannot be listed, and only the root user can view the information when using the Virsh list. So I set the nginx to host root SSH authentication, but in the use of Webvirtmgr Web page login, found and can not log in, need to enter manually, and manually entered after the discovery, is available.
later found the reason , because I run with root webvirtmgr, so need to set Webvirtmgr server root user host root user password login, after setting, can be used.
7. Using the virtual machine console
Click on the virtual machine instance, each virtual machine the last button "console", click to find an error, as shown in
To view the Django background error:
ERROR:django.request:Internal Server Error:/console/
Traceback (most recent):
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 113, in Get_response
Response = callback (Request, *callback_args, **callback_kwargs)
File "/data/apps/webvirtmgr/console/views.py", line +, in console
Response.set_cookie (' token ', token)
Attributeerror: ' str ' object has no attribute ' Set_cookie '
Find its source code, and found that the possible error is because the virtual machine does not have a graphics management tool such as VNC, and then add the following configuration in the virtual machine's XML configuration file:
Virsh Edit oss.webvirtmgr.001
type=‘vnc‘ port=‘5910‘ autoport=‘no‘ listen=‘0.0.0.0‘> type=‘address‘ address=‘0.0.0.0‘/></graphics>
Restart the virtual machine, if still not, first undefine, and then re-based on the XML configuration create try. To download a vnc-viewer, enter ip:5910 to see if it can be accessed as shown in: Description setting VNC is successful
But from the Web page click the console button, found still no, error is server disconnected
When accessing the Django Daemon, only the following information is available:
[26/apr/2016 05:59:56] "Get/console/?token=4-bcc6ca3b-ca6d-6e51-505a-9c86cf58a6b2 http/1.1" 200 7270
Refer to this article: http://ju.outofmemory.cn/entry/145497
Installed Novnc, still reported the same mistake, Baidu Google also can not find the corresponding information. Yum-y install NOVNC, inadvertently found this command on the server Novnc-server
Then knocked the following command: Novnc_server–vnc ipaddr:5920, where ipaddr is the host IP address, 5920 is the virtual machine's VNC port number defined.
[Email protected] ~]# Novnc_server–vnc 192.168.200.230:5920
Warning:could not find Self.pem
Starting webserver and WebSockets proxy on port 6080
WebSocket Server settings:
-Listen on:6080
-Flash Security Policy Server
-Web server. Web Root:/usr/share/novnc
-No SSL/TLS support (no cert file)
-proxying from:6080 to 192.168.200.230:5920
Navigate to this URL:
http://oss-webvirtmgr-001:6080/vnc.html?host=oss-webvirtmgr-001&port=6080
Press Ctrl-c to exit
1:10.1.196.211:plain Non-ssl (ws://) WebSocket connection
1:10.1.196.211:version hybi-13, base64: ' False '
1:connecting to:192.168.200.230:5920
It turned out to be OK, console consoles up.
The question is: if I have 30 VMS, each VM has a VNC port, do I have to write 30 such commands to monitor every port??
Deployment of the KVM management platform Webvirtmgr