From 57710452b1ff7f74019a0b0780477f7d96eab441 Mon Sep 17 00:00:00 2001 From: Eliezer Croitoru Date: Fri, 26 Jan 2024 06:03:30 +0200 Subject: [PATCH] 3 --- Makefile | 59 ++++++++++++++++++++++++++++++----------------- gns3_server.conf | 49 +++++++++++++++++++++++++++++++++++++++ install-docker.sh | 8 +++---- 3 files changed, 91 insertions(+), 25 deletions(-) create mode 100644 gns3_server.conf diff --git a/Makefile b/Makefile index 5830c4c..9a06ece 100644 --- a/Makefile +++ b/Makefile @@ -12,37 +12,50 @@ install-docker: install-gns3-deps: apt update - apt install -y build-essential + apt install -y build-essential jq apt install -y bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu-system qemu-kvm bridge-utils libvirt-daemon-system apt install -y python-dev-is-python3 libelf-dev libpcap-dev python3-pyqt5 xterm cmake apt install -y python3-pyqt5.QtSvg python3-pyqt5.qtwebsockets DEBIAN_FRONTEND=noninteractive apt install -y bash-completion libguestfs-tools bsd-mailx -install-gns3: install-gns3-deps check-deps-path install-busybox-static install-pip install-docker create-gns3-user - git clone --depth 1 https://github.com/GNS3/gns3-server.git; true - git clone --depth 1 https://github.com/GNS3/gns3-gui.git; true - git clone --depth 1 https://github.com/GNS3/vpcs.git; true - git clone --depth 1 https://github.com/GNS3/dynamips.git; true - git clone --depth 1 https://github.com/GNS3/ubridge.git; true - python3 -m pip install --upgrade pip --break-system-packages - cd gns3-server && pip3 install -r requirements.txt --break-system-packages && python3 setup.py install - cd gns3-gui && pip3 install -r requirements.txt --break-system-packages && python3 setup.py install - pip3 install --upgrade requests --break-system-packages - pip3 install --upgrade chardet --break-system-packages -# pip3 install gns3-server -# pip3 install gns3-gui - cd vpcs/src && ./mk.sh && cp -v vpcs /usr/local/bin/vpc - cd dynamips && mkdir build && cd build && cmake .. && make && make install - cd ubridge && make && make install - ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu-kvm;true - cd gns3-server/init && cp gns3.service.systemd /etc/systemd/system/gns3.service - chown root:root /etc/systemd/system/gns3.service - sed -i -e "s@^ExecStart=.*@ExecStart=/usr/local/bin/gns3server@g" /etc/systemd/system/gns3.service +install-gns3: install-gns3-deps check-deps-path install-busybox-static install-pip upgrade-pip3 install-docker create-gns3-user build-gns3-server build-gns3-gui build-gns3-vpcs build-gns3-dynamips build-gns3-ubridge + ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu-kvm; true chown gns3:gns3 /home/gns3/ -R systemctl daemon-reload systemctl enable gns3.service systemctl start gns3.service +build-gns3-server: + git clone --depth 1 https://github.com/GNS3/gns3-server.git; true + cd gns3-server && git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' && git pull origin && git checkout tags/v2.2.45 + python3 -m pip install --upgrade pip --break-system-packages + cd gns3-server && pip3 install -r requirements.txt --break-system-packages && python3 setup.py install + ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu-kvm;true + cd gns3-server/init && cp gns3.service.systemd /etc/systemd/system/gns3.service + chown root:root /etc/systemd/system/gns3.service + sed -i -e "s@^ExecStart=.*@ExecStart=/usr/local/bin/gns3server@g" /etc/systemd/system/gns3.service + mkdir -p /home/gns3/.config/GNS3/2.2/ + cp -vf gns3_server.conf /home/gns3/.config/GNS3/2.2/gns3_server.conf + chown gns3:gns3 /home/gns3/ -R + systemctl daemon-reload + +build-gns3-gui: + git clone --depth 1 https://github.com/GNS3/gns3-gui.git; true + python3 -m pip install --upgrade pip --break-system-packages + cd gns3-gui && pip3 install -r requirements.txt --break-system-packages && python3 setup.py install + +build-gns3-vpcs: + git clone --depth 1 https://github.com/GNS3/vpcs.git; true + cd vpcs/src && ./mk.sh && cp -v vpcs /usr/local/bin/vpc + +build-gns3-dynamips: + git clone --depth 1 https://github.com/GNS3/dynamips.git; true + cd dynamips && mkdir build && cd build && cmake .. && make && make install + +build-gns3-ubridge: + git clone --depth 1 https://github.com/GNS3/ubridge.git; true + cd ubridge && make && make install + upgrade-gns3-server: git clone --depth 1 https://github.com/GNS3/gns3-server.git systemctl stop gns3.service @@ -71,6 +84,10 @@ install-pip: upgrade-pip3: python3 -m pip install --upgrade pip --break-system-packages +upgrade-python-deps: + pip3 install --upgrade requests --break-system-packages + pip3 install --upgrade chardet --break-system-packages + install-busybox-static: apt install -y busybox-static diff --git a/gns3_server.conf b/gns3_server.conf new file mode 100644 index 0000000..231e2be --- /dev/null +++ b/gns3_server.conf @@ -0,0 +1,49 @@ +[Server] +; IP where the server listen for connection +host = 0.0.0.0 +; HTTP port for controlling the servers +port = 3080 +; Path where images of devices are stored +images_path = /home/gns3/GNS3/images + +; Path where user project are stored +projects_path = /home/gns3/GNS3/projects + +; Send crash to the GNS3 team +report_errors = True +; First port of the range allocated to devices telnet console +console_start_port_range = 2001 +; Last port of the range allocated to devices telnet console +console_end_port_range = 5000 +; First port of the range allocated to communication between devices. You need two port by link +udp_start_port_range = 10000 +; Last port of the range allocated to communication between devices. You need two port by link +udp_end_port_range = 20000 +; Path of the ubridge program +ubridge_path = /usr/local/bin/ubridge +; Boolean for enabling HTTP auth +auth = True +; Username for HTTP auth +user = admin +; Password for HTTP auth +password = admin + +[VPCS] +; Path of the VPCS binary +vpcs_path = /usr/local/bin/vpc + +[Dynamips] +allocate_aux_console_ports = False +mmap_support = True +; Path of the dynamips path +dynamips_path = /usr/local/bin/dynamips +sparse_memory_support = True +ghost_ios_support = True + +[IOU] +; Path of the iouyap binary +iouyap_path = /usr/local/bin/iouyap +; Path of your .iourc file. If empty we search in $HOME/.iourc +iourc_path = /home/gns3/.iourc +; Validate if the iourc is correct. If you turn off and your licence is invalid iou will crash without errors +license_check = True diff --git a/install-docker.sh b/install-docker.sh index ce54585..9acc1d9 100755 --- a/install-docker.sh +++ b/install-docker.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -nala update -nala install -y \ +apt update +apt install -y \ apt-transport-https \ ca-certificates \ curl \ @@ -20,9 +20,9 @@ true | add-apt-repository \ $(lsb_release -cs) \ stable" -nala update +apt update -nala install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin +apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin if [ -f "docker-compose-linux-x86_64.xz" ];then unxz docker-compose-linux-x86_64.xz