mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Compare commits
3 commits
79450eac6a
...
c0f31909bd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0f31909bd | ||
|
|
9324b9c36d | ||
|
|
b909a81f51 |
4 changed files with 82 additions and 37 deletions
|
|
@ -32,7 +32,7 @@ WebVirtCloud is a virtualization web interface for admins and users. It can dele
|
||||||
|
|
||||||
## Quick Install with Installer (Beta)
|
## Quick Install with Installer (Beta)
|
||||||
|
|
||||||
Install an OS and run specified commands. Installer supported OSes: Ubuntu 18.04/20.04, Debian 10/11, Centos/OEL/RHEL 8.
|
Install an OS and run specified commands. Installer supported OSes: Ubuntu 20.04/22.04, Debian 10/11, Rocky/Alma/OEL/RHEL 10.
|
||||||
It can be installed on a virtual machine, physical host or on a KVM host.
|
It can be installed on a virtual machine, physical host or on a KVM host.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -94,7 +94,7 @@ Done!!
|
||||||
|
|
||||||
Go to http://serverip and you should see the login screen.
|
Go to http://serverip and you should see the login screen.
|
||||||
|
|
||||||
### Install WebVirtCloud panel (CentOS8/OEL8)
|
### Install WebVirtCloud panel (RHEL Based OS 8/9/10)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo yum -y install epel-release
|
sudo yum -y install epel-release
|
||||||
|
|
@ -123,7 +123,7 @@ python3 manage.py migrate
|
||||||
python3 manage.py collectstatic --noinput
|
python3 manage.py collectstatic --noinput
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Configure the supervisor for CentOS
|
#### Configure the supervisor for RHEL Based OS
|
||||||
|
|
||||||
Add the following after the [include] line (after **files = ...** actually):
|
Add the following after the [include] line (after **files = ...** actually):
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
Django==4.2.20
|
Django==4.2.23
|
||||||
django_bootstrap5==25.1
|
django_bootstrap5==25.1
|
||||||
django-bootstrap-icons==0.9.0
|
django-bootstrap-icons==0.9.0
|
||||||
django-login-required-middleware==0.9.0
|
django-login-required-middleware==0.9.0
|
||||||
django-otp==1.6.0
|
django-otp==1.6.0
|
||||||
django-qr-code==4.1.0
|
django-qr-code==4.2.0
|
||||||
django-auth-ldap==5.1.0
|
django-auth-ldap==5.2.0
|
||||||
djangorestframework==3.16.0
|
djangorestframework==3.16.0
|
||||||
drf-nested-routers==0.94.1
|
drf-nested-routers==0.94.2
|
||||||
drf-yasg==1.21.10
|
drf-yasg==1.21.10
|
||||||
eventlet==0.39.1
|
eventlet==0.40.1
|
||||||
gunicorn==23.0.0
|
gunicorn==23.0.0
|
||||||
libsass==0.23.0
|
libsass==0.23.0
|
||||||
libvirt-python==11.2.0
|
libvirt-python==11.4.0
|
||||||
lxml==5.4.0
|
lxml==6.0.0
|
||||||
ldap3==2.9.1
|
ldap3==2.9.1
|
||||||
markdown==3.6
|
markdown==3.8.2
|
||||||
#psycopg2-binary
|
#psycopg2-binary
|
||||||
python-engineio==4.12.0
|
python-engineio==4.12.0
|
||||||
python-socketio==5.13.0
|
python-socketio==5.13.0
|
||||||
qrcode==8.2
|
qrcode==8.2
|
||||||
rwlock==0.0.7
|
rwlock==0.0.7
|
||||||
tzdata
|
tzdata
|
||||||
websockify==0.12.0
|
websockify==0.13.0
|
||||||
whitenoise==6.9.0
|
whitenoise==6.9.0
|
||||||
zipp==3.21.0
|
zipp==3.23.0
|
||||||
crypt-r==3.13.1
|
crypt-r==3.13.1
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
-r ../conf/requirements.txt
|
-r ../conf/requirements.txt
|
||||||
coverage==7.8.0
|
coverage==7.9.1
|
||||||
django-debug-toolbar==5.2.0
|
django-debug-toolbar==5.2.0
|
||||||
django-debug-toolbar-template-profiler
|
django-debug-toolbar-template-profiler
|
||||||
pycodestyle==2.13.0
|
pycodestyle==2.14.0
|
||||||
pyflakes==3.3.2
|
pyflakes==3.4.0
|
||||||
pylint==3.3.6
|
pylint==3.3.7
|
||||||
yapf==0.43.0
|
yapf==0.43.0
|
||||||
black==25.1.0
|
black==25.1.0
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@ configure_nginx () {
|
||||||
configure_supervisor () {
|
configure_supervisor () {
|
||||||
# Copy template supervisor service for gunicorn and novnc
|
# Copy template supervisor service for gunicorn and novnc
|
||||||
echo " * Copying supervisor configuration"
|
echo " * Copying supervisor configuration"
|
||||||
|
mkdir -p "$supervisor_conf_path" > /dev/null 2>&1
|
||||||
cp "$APP_PATH"/conf/supervisor/webvirtcloud.conf "$supervisor_conf_path"/"$supervisor_file_name"
|
cp "$APP_PATH"/conf/supervisor/webvirtcloud.conf "$supervisor_conf_path"/"$supervisor_file_name"
|
||||||
nginx_group_escape="$(echo -n "$nginx_group"|sed -e 's/[](){}<>=:\!\?\+\|\/\&$*.^[]/\\&/g')"
|
nginx_group_escape="$(echo -n "$nginx_group"|sed -e 's/[](){}<>=:\!\?\+\|\/\&$*.^[]/\\&/g')"
|
||||||
sed -i "s|^\\(user=\\).*|\\1$nginx_group_escape|" "$supervisor_conf_path/$supervisor_file_name"
|
sed -i "s|^\\(user=\\).*|\\1$nginx_group_escape|" "$supervisor_conf_path/$supervisor_file_name"
|
||||||
|
|
@ -208,8 +209,40 @@ run_as_app_user () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_python () {
|
||||||
|
# check if python3 is installed.
|
||||||
|
if ! hash "$PYTHON" 2>/dev/null; then
|
||||||
|
echo "Python3 is not installed. Please install Python3 and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if python3 version is grater than 3.10 amd set it as default
|
||||||
|
if ! "$PYTHON" -c 'import sys; assert sys.version_info >= (3, 10)' >/dev/null 2>&1; then
|
||||||
|
echo "Your Python version is less than 3.10. This script requires Python 3.10 or greater."
|
||||||
|
echo "Please install Python 3.10 or greater and set it as the default version."
|
||||||
|
echo "Use update-alternatives command to set default python version to latest."
|
||||||
|
echo "For example: sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1"
|
||||||
|
echo "Then run this script again."
|
||||||
|
echo "Do not forget to install pip3 and python3-devel for python3.10 or later."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if pip3 is installed
|
||||||
|
if ! hash pip3 2>/dev/null; then
|
||||||
|
echo "pip3 is not installed. Please install pip3 and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
activate_python_environment () {
|
activate_python_environment () {
|
||||||
cd "$APP_PATH" || exit
|
cd "$APP_PATH" || exit
|
||||||
|
# Check if virtualenv is installed
|
||||||
|
if ! "$PYTHON" -c 'import virtualenv' >/dev/null 2>&1; then
|
||||||
|
echo "Virtualenv is not installed. Please install virtualenv and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Create a virtual environment
|
||||||
|
echo "* Creating virtual environment in $APP_PATH/venv"
|
||||||
virtualenv -p "$PYTHON" venv
|
virtualenv -p "$PYTHON" venv
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
|
|
@ -254,6 +287,9 @@ install_webvirtcloud () {
|
||||||
done
|
done
|
||||||
sed -i "s|^\\(CSRF_TRUSTED_ORIGINS = \\).*|\\1\[ \'http://$fqdn\', $host_ip ]|" /srv/webvirtcloud/webvirtcloud/settings.py
|
sed -i "s|^\\(CSRF_TRUSTED_ORIGINS = \\).*|\\1\[ \'http://$fqdn\', $host_ip ]|" /srv/webvirtcloud/webvirtcloud/settings.py
|
||||||
|
|
||||||
|
echo "* Checking up Python3 version."
|
||||||
|
check_python
|
||||||
|
|
||||||
echo "* Activate virtual environment."
|
echo "* Activate virtual environment."
|
||||||
activate_python_environment
|
activate_python_environment
|
||||||
|
|
||||||
|
|
@ -308,19 +344,19 @@ set_hosts () {
|
||||||
}
|
}
|
||||||
|
|
||||||
restart_supervisor () {
|
restart_supervisor () {
|
||||||
echo "* Setting Supervisor to start on boot and restart."
|
echo "* Setting Supervisor to start on boot and restart."
|
||||||
log "systemctl enable $supervisor_service"
|
log "systemctl enable $supervisor_service"
|
||||||
#systemctl enable $supervisor_service
|
#systemctl enable $supervisor_service
|
||||||
log "systemctl restart $supervisor_service"
|
log "systemctl restart $supervisor_service"
|
||||||
#systemctl restart $supervisor_service
|
#systemctl restart $supervisor_service
|
||||||
}
|
}
|
||||||
|
|
||||||
restart_nginx () {
|
restart_nginx () {
|
||||||
echo "* Setting Nginx to start on boot and starting Nginx."
|
echo "* Setting Nginx to start on boot and starting Nginx."
|
||||||
log "systemctl enable nginx.service"
|
log "systemctl enable nginx.service"
|
||||||
#systemctl enable nginx.service
|
#systemctl enable nginx.service
|
||||||
log "systemctl restart nginx.service"
|
log "systemctl restart nginx.service"
|
||||||
#systemctl restart nginx.service
|
#systemctl restart nginx.service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -350,7 +386,7 @@ echo '
|
||||||
'
|
'
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " Welcome to Webvirtcloud Installer for RHEL&Alternatives, Fedora, Debian and Ubuntu!"
|
echo " Welcome to Webvirtcloud Installer for RHEL Based OSes, Debian and Ubuntu!"
|
||||||
echo ""
|
echo ""
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
case $distro in
|
case $distro in
|
||||||
|
|
@ -475,7 +511,7 @@ echo "========="
|
||||||
case $distro in
|
case $distro in
|
||||||
debian)
|
debian)
|
||||||
if [[ "$version" -ge 9 ]]; then
|
if [[ "$version" -ge 9 ]]; then
|
||||||
# Install for Debian 9.x / 10.x
|
# Install for Debian 9.x / 10.x / 12.x
|
||||||
tzone=\'$(cat /etc/timezone)\'
|
tzone=\'$(cat /etc/timezone)\'
|
||||||
|
|
||||||
echo -n "* Updating installed packages."
|
echo -n "* Updating installed packages."
|
||||||
|
|
@ -503,7 +539,7 @@ case $distro in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu)
|
||||||
if [ "$version" == "18.04" ] || [ "$version" == "20.04" ]; then
|
if [ "$version" == "18.04" ] || [ "$version" == "20.04" ] || [ "$version" == "22.04" ]; then
|
||||||
# Install for Ubuntu 18 / 20
|
# Install for Ubuntu 18 / 20
|
||||||
tzone=\'$(cat /etc/timezone)\'
|
tzone=\'$(cat /etc/timezone)\'
|
||||||
|
|
||||||
|
|
@ -532,12 +568,20 @@ case $distro in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
centos)
|
centos)
|
||||||
if [[ "$version" =~ ^8 ]] || [[ "$version" =~ ^9 ]]; then
|
if [[ "$version" =~ ^10 ]]; then
|
||||||
# Install for CentOS/Redhat 8
|
# Install for CentOS/Redhat 10
|
||||||
tzone=\'$(timedatectl|grep "Time zone"| awk '{print $3}')\'
|
tzone=\'$(timedatectl|grep "Time zone"| awk '{print $3}')\'
|
||||||
|
|
||||||
echo "* Adding wget & epel-release repository."
|
if command -v "crb" >/dev/null 2>&1; then
|
||||||
log "yum -y install wget epel-release"
|
echo "* CRB Repo is found, enabling it."
|
||||||
|
log "crb enable > /dev/null 2>&1"
|
||||||
|
else
|
||||||
|
echo "* Enabling CRB repository."
|
||||||
|
log "dnf config-manager --set-enabled crb"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "* Adding wget & epel-release & supervisor repository."
|
||||||
|
log "yum -y install wget epel-release supervisor"
|
||||||
|
|
||||||
echo "* Installing OS requirements."
|
echo "* Installing OS requirements."
|
||||||
PACKAGES="git python3-virtualenv python3-devel libvirt-devel glibc gcc nginx python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5 openldap-devel"
|
PACKAGES="git python3-virtualenv python3-devel libvirt-devel glibc gcc nginx python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5 openldap-devel"
|
||||||
|
|
@ -545,13 +589,15 @@ case $distro in
|
||||||
|
|
||||||
set_hosts
|
set_hosts
|
||||||
|
|
||||||
|
echo "* Configuring virtualenv."
|
||||||
|
log "pip3 install virtualenv"
|
||||||
install_webvirtcloud
|
install_webvirtcloud
|
||||||
|
|
||||||
echo "* Configuring Nginx."
|
echo "* Configuring Nginx."
|
||||||
configure_nginx
|
configure_nginx
|
||||||
|
|
||||||
echo "* Configuring Supervisor."
|
echo "* Configuring Supervisor."
|
||||||
log "pip install supervisor "
|
log "pip3 install supervisor "
|
||||||
configure_supervisor
|
configure_supervisor
|
||||||
|
|
||||||
set_firewall
|
set_firewall
|
||||||
|
|
@ -561,9 +607,8 @@ case $distro in
|
||||||
restart_supervisor
|
restart_supervisor
|
||||||
restart_nginx
|
restart_nginx
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Unsupported CentOS version. Version found: $version"
|
echo "Unsupported RHEL Based OS($distro) version. Version found: $version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue