KVM visual management using third-party software

1. Server environment planning

operating system IP addresses CPU name Remark
Centos7.6 192.168.10.10 KVM nodename1  

2. Preparing the Environment

View the current system version 2.1

[root@KVM-Node1 ~]# hostnamectl 

2.2 Close selinux 

[root@KVM-Node1 ~]# sed -i '/SELINUX=/cSELINUX=disabled' /etc/selinux/config

[root@KVM-Node1 ~]# setenforce 0

2.3 Close firewalld ebtables firewall

[root@KVM-Node1 ~]# systemctl stop ebtables firewalld

[root@KVM-Node1 ~]# systemctl disable ebtables firewalld

3. Procedure

1. Install WebVirtMgr  

WebVirtMgr official reference manual in ⽅

[root@KVM-Node1 ~]# yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

[root@KVM-Node1 ~]# yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx gcc python-devel

[root@KVM-Node1 ~]# pip install numpy

2. Install and set up Django python demand environment

[Root @ KVM Node1 ~] # git clone git: //github.com/retspen/webvirtmgr.git

[root@KVM-Node1 ~]# cd webvirtmgr

[root@KVM-Node1 webvirtmgr]#  pip install -r requirements.txt

[root@KVM-Node1 webvirtmgr]#  ./manage.py syncdb

Enter the user information:

You just installed Django's auth system, which means you don't have any superusers defined.    

# You just Django's auth system installed, which means you do not define any superuser.

Would you like to create one now (yes / no):? Yes # Now you want to create a right? (Yes / No): Yes

Username (leave blank to use 'root'): root # username (blank to use the 'root'): root

Email address: [email protected] # E-mail address: [email protected]

Password: # Password:

Password (again): # Enter the password again

Superuser created successfully. # Supervisor has been successfully created.

[root@KVM-Node1 webvirtmgr]# ./manage.py collectstatic

3. Create a super other users

[root@KVM-Node1 webvirtmgr]# ./manage.py createsuperuser

WARNING:root:No local_settings file found.

Username: chenjiangfeng

Email address: [email protected]

Password: 

Password (again): 

Superuser created successfully.

Configuring nginx

4.1 Mobile Web Directory

[root@KVM-Node1 webvirtmgr]# cd ..

[Root @ KVM node1 ~] # mv webvirtmgr / var / www /

4.2 Add webvirtmgr.conf file in /etc/nginx/conf.d in:

[root@KVM-Node1 ~]# vim /etc/nginx/conf.d/webvirtmgr.conf 

server {

    listen 80 default_server;

    server_name kvm.chenjf.com;

    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; # Set higher depending on your needs 

    }

}

0a787208-dc22-4e1c-94cc-a9637f63bc94

4.3 Open Server section /etc/nginx/conf/nginx.conf /etc/nginx/nginx.conf annotation files, as in the example:

#      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 {

#     }

# }

4.4 Setting permissions of Contents

[root@KVM-Node1 ~]# chown -R nginx:nginx /var/www/webvirtmgr

4.5 start nginx, and add it clicks into boot automatically start

[root@KVM-Node1 ~]# systemctl start nginx

[root@KVM-Node1 ~]# systemctl enable nginx

5. Installation Configuration Supervisor

5.1 Creating a file using the following /etc/supervisord.d/webvirtmgr.ini

[root@KVM-Node1 ~]# vim /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

0b6f4b1b-9575-4c5f-94ce-d9101c401559

5.2 Restart supervisor daemons

[root@KVM-Node1 ~]# systemctl restart supervisord

[root@KVM-Node1 ~]# systemctl enable supervisord

6. The browser access to

040ec29f-bae5-41db-868d-3c201127f2a9

3ab0e1ba-8b2d-4382-994e-ca3583106771

da079114-e911-41d7-8517-98264ca9bf87

7. Configure SSH authentication ssh official ⽅ References

[root@KVM-Node1 ~]# su - nginx -s /bin/bash 

-bash-4.2 $ ssh-keygen (been press Enter)

-bash-4.2$ touch ~/.ssh/config

-bash-4.2$ echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >>~/.ssh/config

-bash-4.2$ chmod 0600 ~/.ssh/config

-bash-4.2$ ssh-copy-id root@localhost

8. After configuration is complete refresh your browser

07379b65-4fb8-46fe-ad45-60d1d550d7c7

ede805b9-c8b8-403d-988b-069d02e99459

Guess you like

Origin blog.51cto.com/10802692/2414767