Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
27c3ae466f | ||
|
20109ff6bb | ||
|
eea249eabb | ||
|
cc44a3df4d |
43
README.md
43
README.md
@ -15,15 +15,15 @@ Server[Server] <----> LXC((LXC))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Install requirements (Debian example
|
## Install requirements (Debian 12 example)
|
||||||
For your safty you can also find the packages on pip or pipx
|
For your safety you can also find the packages on pip or pipx and the requirement.txt file.
|
||||||
|
|
||||||
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-types-pyopenssl
|
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 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://git.nerkdesign.com/pporcheret/Hype-2.git
|
git clone https://github.com/pyhype2/Hype2.git
|
||||||
cd Hype-2
|
cd Hype2
|
||||||
mkdir storage/disks
|
mkdir storage/disks
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -70,7 +70,17 @@ 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
|
||||||
|
|
||||||
@ -86,7 +96,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
|
### Create Database for users (Manual creation)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sqlite3 db.db
|
sqlite3 db.db
|
||||||
@ -199,6 +209,8 @@ 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* :
|
||||||
@ -225,6 +237,25 @@ 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.
|
||||||
|
BIN
__pycache__/app.cpython-311.pyc
Normal file
BIN
__pycache__/app.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
functions/__pycache__/fbackup.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fbackup.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fdisks.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fdisks.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fedit.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fedit.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fhost.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fhost.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fiso.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fiso.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/flxc.cpython-311.pyc
Normal file
BIN
functions/__pycache__/flxc.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fnet.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fnet.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fpool.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fpool.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fscreen.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fscreen.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fvm.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fvm.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fvnc.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fvnc.cpython-311.pyc
Normal file
Binary file not shown.
@ -10,6 +10,13 @@ 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 out2 != 0:
|
if out != 0:
|
||||||
raise Exception("Error on creating interface")
|
raise Exception("Error on creating interface")
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
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):
|
||||||
@ -12,14 +13,15 @@ def get_vnc_port(vm_name):
|
|||||||
return vnc_port
|
return vnc_port
|
||||||
|
|
||||||
def kill_consoles():
|
def kill_consoles():
|
||||||
os.system('kill -9 $(ps -edf | grep websockify | grep -v grep | awk \'{ print $2 }\')')
|
subprocess.run("pkill -9 -f 'websockify'", shell=True)
|
||||||
os.system('for i in $(ps -edf | grep pyxterm | grep -v grep | awk \'{ print $2 }\');do kill -9 $i;done')
|
subprocess.run("for i in $(pgrep -f 'pyxterm'); do kill -9 $i; done", shell=True)
|
||||||
|
|
||||||
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)
|
||||||
os.system('websockify -D --web=/usr/share/novnc/ 6080 localhost:'+vm_port)
|
subprocess.run(['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()
|
||||||
os.system('python3 '+path+'/pyxterm.py --command \'lxc-attach\' --cmd-args \''+lxc_name+'\' &')
|
cmd = ['python3', f'{path}/pyxterm.py', '--command', 'lxc-attach', '--cmd-args', lxc_name]
|
||||||
|
pyx_process = subprocess.Popen(cmd)
|
||||||
|
30
install.sh
Normal file
30
install.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/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…
x
Reference in New Issue
Block a user