Last active
September 12, 2023 10:46
-
-
Save yam-1111/c7dedccf9fd85027330126f841523066 to your computer and use it in GitHub Desktop.
qemu start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -c /dev/kvm ]; then | |
is_kvm="True" | |
sudo apt install kmod -y | |
sudo modprobe -r kvm_intel | |
else | |
is_kvm="False" | |
fi | |
ram_user=$(awk '/MemTotal/ {print $2/1024/1024}' /proc/meminfo) | |
os_user=$(cat /etc/issue) | |
# pre check | |
echo "-------------------------------------------- " | |
echo "| STREAM NWJNS | " | |
echo "| QCOW2 SETUP WIZARD | " | |
printf "| RAM : %15sGB |\n" "$ram_user" | |
printf "| KVM STATUS : %8s |\n" "$is_kvm" | |
echo "---------------------------------------------" | |
echo "installing qemu" | |
sudo apt update && sudo apt upgrade -y | |
sudo apt install -y qemu-kvm libvirt-daemon | |
sudo apt install qemu-utils -y | |
echo "installing ngrok" | |
curl https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz | tar -xz | |
# Prompt the user for input without a line break | |
read -p "Enter the name of the qcow2 file: " qcow2_file | |
read -p "Enter how many gigs the qcow2 will have: " storage_size | |
read -p "Enter ngrok credentials: " ngrok_creds | |
echo "creating the qcow on the current working directory" | |
qemu-img create -f qcow2 "$PWD/$qcow2_file.qcow2" "$storage_size"G | |
echo "attaching ngrok creds..." | |
./ngrok authtoken "$ngrok_creds" | |
echo "" | |
echo "" | |
echo "finished creating! do not forget to stream newjns while running vm" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment