一. webvirtualcloud部署
1.关闭防火墙
systemctl stop firewalld
修改配置文件:selinux=disabled (要重启生效)
2.安装epel-release
yum -y install epel-release
yum -y install python3-virtualenv python3-devel libvirt-devel glibc gcc \
nginx supervisor python3-lxml git python3-libguestfs iproute-tc \
cyrus-sasl-md5 python3-libguestfs
3.克隆
进入srv目录: cd /srv
进行克隆:git clone https://github.com/retspen/webvirtcloud
进入webvirtcloud目录:cd webvirtcloud
升级本地的pip:pip3 install -i https://mirrors.ustc.edu.cn/pypi/web/simple pip -U
配置pip源:pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
升级一些安装包:pip install -U setuptools virtualenv
4.修改配置文件
修改脚本:cp webvirtcloud/settings.py.template webvirtcloud/settings.py
创建python虚拟环境:virtualenv -p $(which python3) /srv/envs/webvirtcloud
进入虚拟环境:source /srv/envs/webvirtcloud/bin/activate
执行脚本生成加密字符串:python /srv/webvirtcloud/conf/runit/secret_generator.py
将字符串添加进脚本中:SECRET_KEY = "X^*tIo&S|GhwygIp3}X)qs{wkcAy=vay~.%4^kU#,iKZs*\`&V"
5.安装第三方仓库
安装仓库:pip install -r conf/requirements.txt
数据预处理: python manage.py makemigrations
进行数据迁移:python manage.py migrate
6.编辑webvirtcloud.ini文件
vim /etc/supervisord.d/webvirtcloud.ini
[program:webvirtcloud]
command=/srv/envs/webvirtcloud/bin/gunicorn webvirtcloud.wsgi:application -c /srv/webvirtcloud/gunicorn.conf.py
directory=/srv/webvirtcloud
user=root
autostart=true
autorestart=true
redirect_stderr=true
[program:novncd]
command=/srv/envs/webvirtcloud/bin/python /srv/webvirtcloud/console/novncd
directory=/srv/webvirtcloud
user=root
autostart=true
autorestart=true
redirect_stderr=true
7.设置开机启动webvirtcloud
开机启动:systemctl enable supervisord
现在启动:systemctl start supervisord
加载:supervisorctl reload
更新: supervisorctl update
重新启动: supervisorctl restart all
查看启动状态:supervisorctl status
8.配置nginx
编辑配置文件:cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
开机启动:systemctl enable --now nginx
9.修改nginx配置文件
vim /etc/nginx/nginx.conf
注释掉server,然后再重启服务就可以了