1 install epel 源,git,gcc等软件
sudo yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
2 Install python requirements and setup Django environment
git clone git://github.com/retspen/webvirtmgr.git
cd webvirtmgr
sudo pip install -r requirements.txt
https://www.cnblogs.com/xiaoyuxixi/p/manage.py syncdb
https://www.cnblogs.com/xiaoyuxixi/p/manage.py collectstatic ---配置数据库的账号
创建一个超级用户:
https://www.cnblogs.com/xiaoyuxixi/p/manage.py createsuperuser --配置webvirtmgr 登录账号
3 配置nginx
cd ..
sudo mv webvirtmgr /var/www/
在 /etc/nginx/conf.d/下 创建webvirtmgr.conf 文件:
vim /etc/nginx/conf.d/webvirtmgr.conf
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
}
}
在nginx主配置文件中的http域内添加下面的配置
sudo vim /etc/nginx/nginx.conf
include /etc/nginx/conf.d/*.conf;
将default.conf重命名
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
重启nginx:
sudo service nginx restart 或者 /etc/init.d/nginx restart
selinux 设置:
将selinux 关闭
setenforce 0
vim /etc/selinux/config
SELINUX=disabled
或不关闭selinux但需添加下面的策略
/usr/sbin/setsebool httpd_can_network_connect true
4 配置 Supervisor
sudo chkconfig supervisord on
在/etc/supervisord.conf末尾加入下面的配置:
vim /etc/supervisord.conf
[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
重启supervisord
sudo service supervisord restart
--------到这里webvirtmgr配置完成-----
1)webvirtmgr与kvm之间使用ssh方式连接管理
1 在webvirtmgr服务器(服务端)上:
cd /home/
mkdir nginx
chown nginx.nginx nginx/
chmod 700 nginx/ -R
su - nginx -s /bin/bash
ssh-keygen ---期间输入yes后直接回车,回车
touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no
特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。
0 条相关评论