[root@sf85:/data/kvm]# cat install-webvirtmgr.sh
#!/usr/bin/env bash
# 日志输出函数
function log()
{
local _level=$1
shift
local _msg=$*
local _ts=$(date +”%F %T”)
case $_level in
info) echo -e “$_ts [INFO] $_msg”;;
notice) echo -e “$_ts [NOTE] \033[92m$_msg\033[0m”;;
warn) echo -e “$_ts [WARN] \033[93m$_msg\033[0m”;;
error) echo -e “$_ts [ERROR] \033[91m$_msg\033[0m”;;
esac
}
function ins_wvg() {
log notice “安装依赖”
yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
yum -y install gcc python-devel
pip install numpy
log notice “安装 python 包”
git clone git://github.com/retspen/webvirtmgr.git
cd webvirtmgr
pip install -r requirements.txt # or python-pip (RedHat, Fedora, CentOS, OpenSuse)
}
./manage.py syncdb
./manage.py collectstatic
cd /data/sh/
nohup /usr/bin/python /var/www/webvirtmgr/manage.py run_gunicorn 127.0.0.1:8000 &
nohup /usr/bin/python /var/www/webvirtmgr/console/webvirtmgr-console &
https://blog.51cto.com/xinsz08/5087094
http://www.javashuo.com/article/p-qkrcdhba-bc.html