This is the 10th day of my participation in the August More Text Challenge
Today, a friend of mine asked for help in a private letter. The company asked him to deploy a WebVirMgr platform. He had never contacted me before and had to come to me for help. So I took the time to write this article in the hope that you might find it useful.
Introduction to webVirmgr management platform
WebVirtMgr is a KVM management platform that has been developing fast, active and fresh for nearly a year. VirtManager should be pagified.
The entire platform is developed in Python, with a Python-based Django front end and a Libvirt python back end. The style is also Python style and features are:
- Easy to use
- Libvirt-based connection.
- Vm life cycle management.
- Host management supports the following functions:
- CPU usage.
- Memory usage.
- Manage network resource pools.
- Storage resource pool management.
- Vm image.
- Vm cloning.
- Snapshot management.
- Day management.
The deployment environment
Operating system kernel: [root@itlaoxin-17 ~]# uname -r 3.10.0-1062.el7.x86_64
[root@itlaoxin-17 ~]# cat /etc/red Hat -release CentOS Linux release 7.7.1908 (Core)
Installing dependency packages
Yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum
yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
yum -y install gcc python-devel
Copy the code
Check whether PIP –help is installed
After checking PIP is installed, install Numpy directly
pip install numpy
Copy the code
Note: NumPy(Numerical Python) is an extension of The Python language, supporting a large number of dimensional array and matrix operations, in addition to providing a large number of mathematical functions for array operations.
- Install Python and Django
Download the github source code directly here
git clone git://github.com/retspen/webvirtmgr.git cd webvirtmgr pip install -r requirements.txt pip install --upgrade PIP (you can skip this command)./manage.py syncdbCopy the code
The following output is displayed:
You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): yes Username (leave blank to use 'root'): root Email address: [email protected] Password: zhl****! Password (again): Superuser created successfully. Installing custom SQL ... Installing indexes ... Installed 6 object(s) from 1 fixture(s) The following command is the administrator account, user name, and password as set above. ./manage.py collectstatic This will overwrite existing files! Are you sure you want to do this? Type 'yes' to continue, or 'no' to cancel: yes./manage.py createsuperuser Adds another user (optional)Copy the code
Start installation:
[root@iZ2zeeg42qkecbgssbgkqtZ webvirtmgr]# ./manage.py createsuperuser
WARNING:root:No local_settings file found.
Username: admin
Email address: [email protected]
Password: zhl***!
Password (again):
Superuser created successfully.
Copy the code
[root@iZ2zeeg42qkecbgssbgkqtZ webvirtmgr]# #cd .. The directory is /root sudo mv webvirtmgr /var/www/
vim /etc/nginx/conf.d
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 } }Copy the code
Vim /etc/nginx/nginx.conf
# server { # listen 80 default_server; # server_name localhost; # root /usr/share/nginx/html; # # #charset koi8-r; # # #access_log /var/log/nginx/host.access.log main; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # # redirect server error pages to the static page /40x.html # # # error_page 404 /404.html; # location = /40x.html { # } # # redirect server error pages to the static page /50x.html # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # }Copy the code
Tips for removing #
CTRL + V selects the # sign — press X to remove the pound sign
Next, we need to grant permissions and start nginx
Nginx :nginx /var/www/webvirtmgr restart nginx #service nginx restart #/usr/sbin/setsebool #chkconfig supervisord on #chown -r nginx:nginx /var/www/webvirtmgrCopy the code
This is the 10th day of my participation in the August More Text Challenge
Next, we configure webvirtmgr.ini
#vim /etc/supervisord.d/webvirtmgr.ini
Complete the configuration according to the following code, including users and other content
[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
Copy the code
- Restart the Supervisor daemon
service supervisord stop
service supervisord start
- Access to the test
./manage.py runserver 0:8000
http://39.97.97.79:8000/login/