This commit is contained in:
root 2024-01-26 03:27:06 +02:00
commit e8f75f22e4
2 changed files with 109 additions and 0 deletions

75
Makefile Normal file
View File

@ -0,0 +1,75 @@
all:
echo OK
install-docker:
bash install-docker.sh
install-gns3-deps:
apt update
apt install -y build-essential
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 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
chown gns3:gns3 /home/gns3/ -R
systemctl daemon-reload
systemctl enable gns3.service
systemctl start gns3.service
upgrade-gns3-server:
git clone --depth 1 https://github.com/GNS3/gns3-server.git
systemctl stop gns3.service
cd gns3-server && pip3 install -r requirements.txt --break-system-packages && python3 setup.py install
systemctl start gns3.service
create-gns3-user:
useradd gns3;true
mkdir -p /home/gns3
rsync -av /etc/skel/ /home/gns3/
usermod -a -G qemu gns3;true
usermod -a -G kvm gns3;true
usermod -a -G libvirt gns3;true
usermod -a -G docker gns3;true
cleanup-gns3-sources:
rm -fr gns3-server
rm -fr dynamips
rm -fr gns3-gui
rm -fr ubridge
rm -fr vpcs
install-pip:
apt install -y python3-pip
upgrade-pip3:
python3 -m pip install --upgrade pip --break-system-packages
install-busybox-static:
apt install -y busybox-static
get-busy-box-static:
bash get-busy-box-static.sh
disable-firewalld:
systemctl disable --now firewalld

34
install-docker.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
nala update
nala install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
lsb-release \
software-properties-common jq
DOCKER_COMPOSE_VERSION=$( curl -s 'https://api.github.com/repos/docker/compose/releases' |jq -r .[0].tag_name)
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
true | apt-key fingerprint 0EBFCD88
true | add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
nala update
nala 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
cp -v docker-compose-linux-x86_64 /usr/bin/docker-compose
else
curl -SL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64" -o /usr/bin/docker-compose
fi
chmod +x /usr/bin/docker-compose