WebVirMgr的搭建过程

举报
互联网老辛 发表于 2021/06/08 23:29:50 2021/06/08
【摘要】 操作系统是7的系统: 平台介绍: https://my.oschina.net/HeAlvin/blog/498119 部署文档 https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr 操作系统内核: uname -r 操作系统: lsb_release -a yum -y install h...

操作系统是7的系统:

平台介绍:
https://my.oschina.net/HeAlvin/blog/498119

部署文档
https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr

操作系统内核: uname -r

操作系统: lsb_release -a

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

  
 
  • 1
  • 2
  • 3
  • 4
  • 5

查看pip是否已经安装 pip --help

pip install numpy

  
 
  • 1
  1. 安装Python环境和Django环境
git clone git://github.com/retspen/webvirtmgr.git
 
cd webvirtmgr
pip install -r requirements.txt
 
pip install --upgrade pip(此命令可以不执行)
 
./manage.py syncdb

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

执行命令输出内容如下:

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: 1878547732@qq.com
Password: zhl****!
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 6 object(s) from 1 fixture(s) 
下面的命令是管理员账号,用户名,密码就是上面设置的用户名密码。
./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  添加另外一个用户 (不添加也行)

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

[root@iZ2zeeg42qkecbgssbgkqtZ webvirtmgr]# ./manage.py createsuperuser

WARNING:root:No local_settings file found.
Username: admin
Email address: 1878547732@qq.com
Password: zhl***!
Password (again):
Superuser created successfully.

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

[root@iZ2zeeg42qkecbgssbgkqtZ webvirtmgr]#
#cd …
此时路径在 /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 }
} 
  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

#表格里的全部注释掉
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 {
# }
# } 

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
#chown -R nginx:nginx /var/www/webvirtmgr
 
#service nginx restart
#/usr/sbin/setsebool httpd_can_network_connect true 
#chkconfig supervisord on
#chown -R nginx:nginx /var/www/webvirtmgr

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

#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

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  1. 重新启动supervisor守护程序
    service supervisord stop

service supervisord start

  1. 访问测试
    ./manage.py runserver 0:8000

http://39.97.97.79:8000/login/

文章来源: zmedu.blog.csdn.net,作者:互联网老辛,版权归原作者所有,如需转载,请联系作者。

原文链接:zmedu.blog.csdn.net/article/details/89439501

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。