zoraxy-install.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y git
  18. msg_ok "Installed Dependencies"
  19. msg_info "Installing Golang"
  20. set +o pipefail
  21. RELEASE=$(curl -s https://go.dev/dl/ | grep -o "go.*\linux-amd64.tar.gz" | head -n 1)
  22. wget -q https://golang.org/dl/$RELEASE
  23. $STD tar -xzf $RELEASE -C /usr/local
  24. $STD ln -s /usr/local/go/bin/go /usr/local/bin/go
  25. set -o pipefail
  26. msg_ok "Installed Golang"
  27. msg_info "Installing Zoraxy (Patience)"
  28. $STD git clone https://github.com/tobychui/zoraxy /opt/zoraxy
  29. cd /opt/zoraxy/src
  30. $STD go mod tidy
  31. $STD go build
  32. msg_ok "Installed Zoraxy"
  33. msg_info "Creating Service"
  34. cat <<EOF >/etc/systemd/system/zoraxy.service
  35. [Unit]
  36. Description=General purpose request proxy and forwarding tool
  37. After=syslog.target network-online.target
  38. [Service]
  39. ExecStart=/opt/zoraxy/src/./zoraxy
  40. WorkingDirectory=/opt/zoraxy/src/
  41. Restart=always
  42. [Install]
  43. WantedBy=multi-user.target
  44. EOF
  45. systemctl enable -q --now zoraxy.service
  46. msg_ok "Created Service"
  47. motd_ssh
  48. customize
  49. msg_info "Cleaning up"
  50. rm -rf $RELEASE
  51. $STD apt-get autoremove
  52. $STD apt-get autoclean
  53. msg_ok "Cleaned"