vps.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/bash
  2. # Three-in-One-Step Automated Install WireGuard Shadowsocks V2Ray on Server. URL: https://git.io/vps.setup
  3. # Usage: bash <(curl -L -s https://git.io/vps.setup)
  4. # Default Three-in-One-Step Automated Installation
  5. default_install(){
  6. # WireGuard installer
  7. wget -qO- https://git.io/wireguard.sh | bash
  8. # Install WireGuard+Speeder+Udp2Raw and SS+Kcp+Udp2RAW Configuration
  9. bash wgmtu setup
  10. # Install Shadowsocks & V2Ray
  11. bash <(curl -L -s https://git.io/v2ray_ss.sh)
  12. }
  13. display_conf(){
  14. echo
  15. echo
  16. echo_SkyBlue "# ======================================="
  17. echo_GreenBG "# V2ray Server Configuration: /etc/v2ray/config.json"
  18. cat /etc/v2ray/config.json
  19. echo
  20. echo_SkyBlue "# WG+Speed+Udp2Raw and SS+Kcp+Udp2RAW Configuration: /etc/rc.local"
  21. cat vps_setup.log
  22. echo_GreenBG "# WireGuard Client Configuration: /etc/wireguard/client.conf"
  23. cat /etc/wireguard/client.conf
  24. }
  25. base_tools(){
  26. # Simple Judgment System: Debian / Centos
  27. if [ -e '/etc/redhat-release' ]; then
  28. yum update -y && yum install -y wget curl vim ca-certificates
  29. else
  30. apt update && apt install -y wget curl vim ca-certificates
  31. fi
  32. }
  33. wget_curl(){
  34. if [[ ! -e /usr/bin/wget ]]; then
  35. base_tools
  36. fi
  37. if [[ ! -e /usr/bin/curl ]]; then
  38. base_tools
  39. fi
  40. }
  41. # Setting Menu
  42. start_menu(){
  43. clear
  44. echo_GreenBG "> Open Source Project: https://github.com/hongwenjun/vps_setup "
  45. echo_SkyBlue "> 1. Default Three-in-One-Step Automated WireGuard Shadowsocks V2Ray "
  46. echo_SkyBlue "> 2. Choose to install WireGuard VPN Multi-user Configuration "
  47. echo_SkyBlue "> 3. Compile install / Update ${RedBG} shadowsocks-libev ${Font}"
  48. echo_SkyBlue "> 4. Uninstall WireGuard Shadowsocks V2ray Service"
  49. echo "-------------------------------------------------------"
  50. echo_Yellow "> 5. Display WireGuard V2ray and rc.local Configuration"
  51. echo_Yellow "> 6. Exit"
  52. echo_Yellow "> 7. WireGuard Management Command: ${RedBG} bash wgmtu "
  53. echo_Yellow "> 8. Choose to install ${GreenBG} Shadowsocks and V2Ray ${Yellow} Generate and Display QR_code"
  54. read -p "Please Enter the Number to Choose (Press Enter to Default):" num
  55. case "$num" in
  56. 1)
  57. default_install
  58. ;;
  59. 2)
  60. wget -qO- https://git.io/wireguard.sh | bash
  61. ;;
  62. 3)
  63. bash <(curl -L -s git.io/fhExJ) update
  64. ;;
  65. 4)
  66. bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove
  67. bash wgmtu remove
  68. ;;
  69. 5)
  70. display_conf
  71. ;;
  72. 6)
  73. exit 1
  74. ;;
  75. 7)
  76. # Get WireGuard Management Command : bash wgmtu
  77. wget -O ~/wgmtu https://raw.githubusercontent.com/hongwenjun/vps_setup/english/wgmtu.sh
  78. bash wgmtu
  79. ;;
  80. 8)
  81. bash <(curl -L -s https://git.io/v2ray_ss.sh)
  82. ;;
  83. *)
  84. default_install
  85. ;;
  86. esac
  87. }
  88. # Definition Display Text Color
  89. Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
  90. Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
  91. echo_SkyBlue(){
  92. echo -e "${SkyBlue}$1${Font}"
  93. }
  94. echo_Yellow(){
  95. echo -e "${Yellow}$1${Font}"
  96. }
  97. echo_GreenBG(){
  98. echo -e "${GreenBG}$1${Font}"
  99. }
  100. # Now, install wg ss v2 wget curl
  101. wget_curl
  102. start_menu