Compare commits
No commits in common. "main" and "3.0" have entirely different histories.
43
README.md
43
README.md
|
@ -15,15 +15,15 @@ Server[Server] <----> LXC((LXC))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Install requirements (Debian 12 example)
|
## Install requirements (Debian example
|
||||||
For your safety you can also find the packages on pip or pipx and the requirement.txt file.
|
For your safty you can also find the packages on pip or pipx
|
||||||
|
|
||||||
1 - Update and Install packages :
|
1 - Update and Install packages :
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
apt-get update -y -qq
|
apt-get update -y -qq
|
||||||
apt-get install git lxc lxcfs lxc-templates qemu qemu-utils qemu-kvm virtinst bridge-utils virt-manager libvirt-daemon libvirt-daemon-system virt-viewer libvirt-clients libosinfo-bin websockify sqlite3 novnc
|
apt-get install git lxc lxcfs lxc-templates qemu qemu-utils qemu-kvm virtinst bridge-utils virt-manager libvirt-daemon libvirt-daemon-system virt-viewer libvirt-clients libosinfo-bin websockify sqlite3 novnc
|
||||||
apt-get install python3 python3-flask python3-flask-login python3-flask-sqlalchemy python3-requests python3-lxc python3-libvirt python3-psutil python3-werkzeug python3-websockify python3-novnc python3-flask-socketio python3-openssl
|
apt-get install python3 python3-flask python3-flask-login python3-flask-sqlalchemy python3-requests python3-lxc python3-libvirt python3-psutil python3-werkzeug python3-websockify python3-novnc python3-flask-socketio python3-types-pyopenssl
|
||||||
|
|
||||||
apt-get install openvswitch-switch openvswitch-common
|
apt-get install openvswitch-switch openvswitch-common
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ apt-get install openvswitch-switch openvswitch-common
|
||||||
Clone the repository :
|
Clone the repository :
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/pyhype2/Hype2.git
|
git clone https://git.nerkdesign.com/pporcheret/Hype-2.git
|
||||||
cd Hype2
|
cd Hype-2
|
||||||
mkdir storage/disks
|
mkdir storage/disks
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -70,17 +70,7 @@ address XXX.XXX.XXX.XXX
|
||||||
netmask YYY.YYY.YYY.YYY
|
netmask YYY.YYY.YYY.YYY
|
||||||
gateway ZZZ.ZZZ.ZZZ.ZZZ
|
gateway ZZZ.ZZZ.ZZZ.ZZZ
|
||||||
```
|
```
|
||||||
4 - Modify Qemu configuration
|
|
||||||
|
|
||||||
You will have to uncomment these lines :
|
|
||||||
|
|
||||||
```sh
|
|
||||||
vnc_listen = "0.0.0.0"
|
|
||||||
user=root
|
|
||||||
group=root
|
|
||||||
```
|
|
||||||
|
|
||||||
This will ajust rights for Qemu to run as root and enable VNC on all address for the console.
|
|
||||||
|
|
||||||
## Database for users
|
## Database for users
|
||||||
|
|
||||||
|
@ -96,7 +86,7 @@ For security reason, you should remove **db.db.admin_example**
|
||||||
|
|
||||||
If you want to create this database by yourself, you can :
|
If you want to create this database by yourself, you can :
|
||||||
|
|
||||||
### Create Database for users (Manual creation)
|
### Create Database for users
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sqlite3 db.db
|
sqlite3 db.db
|
||||||
|
@ -209,8 +199,6 @@ and go to https://www.example.com (or https://<server_ip>:5007 without RP) with
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
NB: The first LXC creation will take time to download files. Be patient
|
|
||||||
|
|
||||||
## Systemd
|
## Systemd
|
||||||
|
|
||||||
You can manage hype using Systemd management by creating a file *hype.service* :
|
You can manage hype using Systemd management by creating a file *hype.service* :
|
||||||
|
@ -237,25 +225,6 @@ systemctl start hype.service
|
||||||
|
|
||||||
You can also change some configuration in the file *configuration.py* such as flask port, storage location...use it at your own risk.
|
You can also change some configuration in the file *configuration.py* such as flask port, storage location...use it at your own risk.
|
||||||
|
|
||||||
|
|
||||||
## Windows requirement (Virtuio)
|
|
||||||
If you plan to install some Windows Virtual Machine, you will need to download the Virtuo (Windows drivers IO) and place the ISO in the *<hype_path>/storage/win* folder.
|
|
||||||
|
|
||||||
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.229-1/
|
|
||||||
|
|
||||||
|
|
||||||
You will also need to configure the ISO name in the *configuration.py* file.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
virtuo_path= path+'/storage/win/'
|
|
||||||
virtuo_file='virtio-win-0.1.229.iso'
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
NB: Depending on the Windows version you need, you will need to use a specific Virtio version.
|
|
||||||
Lastest version will remove the old Windows version driver.
|
|
||||||
|
|
||||||
|
|
||||||
## Others
|
## Others
|
||||||
|
|
||||||
You can upload ISO directly from the interface.
|
You can upload ISO directly from the interface.
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -10,13 +10,6 @@ def get_version():
|
||||||
vhype = hype_version
|
vhype = hype_version
|
||||||
return vlxc, vlibvirt, vhype
|
return vlxc, vlibvirt, vhype
|
||||||
|
|
||||||
def get_vm_infos(vm_name):
|
|
||||||
dom = conn.lookupByName(vm_name)
|
|
||||||
vm_info = dom.guestInfo()
|
|
||||||
vm_infos=[]
|
|
||||||
vm_infos=[vm_info['os.id'],vm_info['os.pretty-name'],vm_info['os.kernel-release']]
|
|
||||||
return vm_infos
|
|
||||||
|
|
||||||
|
|
||||||
def set_memory(vm_name,memory_new):
|
def set_memory(vm_name,memory_new):
|
||||||
dom = conn.lookupByName(vm_name)
|
dom = conn.lookupByName(vm_name)
|
||||||
|
|
|
@ -45,7 +45,7 @@ def get_int(net_name):
|
||||||
def create_vswitch_int(net_int):
|
def create_vswitch_int(net_int):
|
||||||
cmd="ovs-vsctl add-br "+net_int
|
cmd="ovs-vsctl add-br "+net_int
|
||||||
out = subprocess.call(cmd, shell=True)
|
out = subprocess.call(cmd, shell=True)
|
||||||
if out != 0:
|
if out2 != 0:
|
||||||
raise Exception("Error on creating interface")
|
raise Exception("Error on creating interface")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from config import *
|
from config import *
|
||||||
from xml.etree import ElementTree as ET
|
from xml.etree import ElementTree as ET
|
||||||
from flask import request, Response
|
from flask import request, Response
|
||||||
import subprocess
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def get_vnc_port(vm_name):
|
def get_vnc_port(vm_name):
|
||||||
|
@ -13,15 +12,14 @@ def get_vnc_port(vm_name):
|
||||||
return vnc_port
|
return vnc_port
|
||||||
|
|
||||||
def kill_consoles():
|
def kill_consoles():
|
||||||
subprocess.run("pkill -9 -f 'websockify'", shell=True)
|
os.system('kill -9 $(ps -edf | grep websockify | grep -v grep | awk \'{ print $2 }\')')
|
||||||
subprocess.run("for i in $(pgrep -f 'pyxterm'); do kill -9 $i; done", shell=True)
|
os.system('for i in $(ps -edf | grep pyxterm | grep -v grep | awk \'{ print $2 }\');do kill -9 $i;done')
|
||||||
|
|
||||||
def socket_connect(vm_name):
|
def socket_connect(vm_name):
|
||||||
kill_consoles()
|
kill_consoles()
|
||||||
vm_port = get_vnc_port(vm_name)
|
vm_port = get_vnc_port(vm_name)
|
||||||
subprocess.run(['websockify', '-D', '--web=/usr/share/novnc/', '6080', 'localhost:' + vm_port])
|
os.system('websockify -D --web=/usr/share/novnc/ 6080 localhost:'+vm_port)
|
||||||
|
|
||||||
def pyxterm_connect(path,lxc_name):
|
def pyxterm_connect(path,lxc_name):
|
||||||
kill_consoles()
|
kill_consoles()
|
||||||
cmd = ['python3', f'{path}/pyxterm.py', '--command', 'lxc-attach', '--cmd-args', lxc_name]
|
os.system('python3 '+path+'/pyxterm.py --command \'lxc-attach\' --cmd-args \''+lxc_name+'\' &')
|
||||||
pyx_process = subprocess.Popen(cmd)
|
|
||||||
|
|
30
install.sh
30
install.sh
|
@ -1,30 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Hype² installation script
|
|
||||||
# Tested on Debian 11 and Debian 12
|
|
||||||
#
|
|
||||||
# 1.0 by Pierre Porcheret
|
|
||||||
#
|
|
||||||
#
|
|
||||||
clear
|
|
||||||
echo "Requirements packages"
|
|
||||||
apt-get update -y -qq
|
|
||||||
apt-get install git lxc lxcfs lxc-templates qemu qemu-utils qemu-kvm virtinst bridge-utils virt-manager libvirt-daemon libvirt-daemon-system virt-viewer libvirt-clients libosinfo-bin websockify sqlite3 novnc
|
|
||||||
apt-get python3-openssl
|
|
||||||
echo "Openswitch install"
|
|
||||||
apt-get install openvswitch-switch openvswitch-common
|
|
||||||
echo "Python libs install"
|
|
||||||
apt-get install python3 python3-flask python3-flask-login python3-flask-sqlalchemy python3-requests python3-lxc python3-libvirt python3-psutil python3-werkzeug python3-websockify python3-novnc python3-flask-socketio
|
|
||||||
echo "Enabling Libvirt"
|
|
||||||
systemctl --quiet enable --now libvirtd
|
|
||||||
systemctl --quiet start libvirtd
|
|
||||||
echo "Bridged interface installation"
|
|
||||||
cp ./bridged.xml /usr/share/libvirt/networks/
|
|
||||||
virsh net-define bridged.xml
|
|
||||||
virsh net-start bridged
|
|
||||||
virsh net-autostart bridged
|
|
||||||
echo "Copy default database"
|
|
||||||
cp db.db.admin_example db.db
|
|
||||||
clear
|
|
||||||
echo "Installation Done"
|
|
||||||
echo "Please follow the Qemu modification according to README.md"
|
|
Loading…
Reference in New Issue