vps.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #!/bin/bash
  2. # WireGuard Shadowsocks V2Ray 服务端三合一脚本 短网址 https://git.io/vps.sh
  3. # Usage: bash <(curl -L -s https://git.io/vps.sh)
  4. # 默认安装三合一 Usage: wget -qO- git.io/vps.sh | bash
  5. default_install(){
  6. # 一键安装wireguard 脚本
  7. wget -qO- git.io/fptwc | bash
  8. # V2Ray官方一键脚本
  9. bash <(curl -L -s https://install.direct/go.sh)
  10. # 一键安装shadowsocks-libev脚本
  11. wget -qO- git.io/fhExJ | bash
  12. # 安装 WireGuard+Speeder+Udp2Raw 和 SS+Kcp+Udp2RAW 配置
  13. bash wgmtu setup
  14. }
  15. display_conf(){
  16. echo
  17. echo
  18. echo_SkyBlue "# ======================================="
  19. echo_GreenBG "# V2ray 服务端配置 /etc/v2ray/config.json"
  20. cat /etc/v2ray/config.json
  21. echo
  22. echo_SkyBlue "# WG+Speed+Udp2Raw 和 SS+Kcp+Udp2RAW 配置 /etc/rc.local"
  23. cat vps_setup.log
  24. echo_GreenBG "# WireGuard 客户端配置 /etc/wireguard/client.conf"
  25. cat /etc/wireguard/client.conf
  26. }
  27. base_tools(){
  28. # 简化判断系统 debian/centos 族群
  29. if [ -e '/etc/redhat-release' ]; then
  30. yum update -y && yum install -y wget curl vim ca-certificates
  31. else
  32. apt update && apt install -y wget curl vim ca-certificates
  33. fi
  34. }
  35. wget_curl(){
  36. if [[ ! -e /usr/bin/wget ]]; then
  37. base_tools
  38. fi
  39. if [[ ! -e /usr/bin/curl ]]; then
  40. base_tools
  41. fi
  42. }
  43. vps_remove(){
  44. bash <(curl -L -s https://install.direct/go.sh) --remove
  45. bash wgmtu remove
  46. cd /root && rm -f v2ray_ss.log vps_setup.log wg5 wgmtu /var/ip_addr /etc/v2ray/config.json \
  47. base64_shadowsocks.conf base64_v2ray_vmess.json
  48. }
  49. # 设置菜单
  50. start_menu(){
  51. clear
  52. echo_GreenBG "> 开源项目: https://github.com/hongwenjun/vps_setup "
  53. echo_SkyBlue "> 1. 默认安装 WireGuard Shadowsocks V2Ray 服务端三合一"
  54. echo_SkyBlue "> 2. 选择安装 WireGuard 多用户服务端"
  55. echo_SkyBlue "> 3. 编译安装/更新 ${RedBG} shadowsocks-libev ${Font}"
  56. echo_SkyBlue "> 4. 卸载 WireGuard Shadowsocks V2ray 服务程序"
  57. echo "-------------------------------------------------------"
  58. echo_Yellow "> 5. 显示 WireGuard V2ray 和 rc.local 配置信息"
  59. echo_Yellow "> 6. 退出"
  60. echo_Yellow "> 7. WireGuard 管理命令 ${RedBG} bash wgmtu "
  61. echo_Yellow "> 8. 选择安装 ${GreenBG} Shadowsocks 和 V2Ray ${Yellow} 配置显示二维码"
  62. echo_Yellow "> 9. 选择安装 ${RedBG} Trojan 傻瓜一键版 ${Yellow}"
  63. read -p "请输入数字:" -t 30 num
  64. case "$num" in
  65. 1)
  66. default_install
  67. ;;
  68. 2)
  69. wget -qO- git.io/fptwc | bash
  70. ;;
  71. 3)
  72. bash <(curl -L -s git.io/fhExJ) update
  73. ;;
  74. 4)
  75. vps_remove
  76. ;;
  77. 5)
  78. display_conf
  79. ;;
  80. 6)
  81. exit 1
  82. ;;
  83. 7)
  84. bash <(curl -L -s https://git.io/wgmtu)
  85. wget -O wgmtu https://git.io/wgmtu >/dev/null 2>&1
  86. ;;
  87. 8)
  88. bash <(curl -L -s https://git.io/v2ray.ss)
  89. ;;
  90. 9)
  91. bash <(curl -L -s https://git.io/trojan.sh)
  92. ;;
  93. *)
  94. default_install
  95. ;;
  96. esac
  97. }
  98. # 显示文字颜色
  99. Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
  100. Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
  101. echo_SkyBlue(){
  102. echo -e "${SkyBlue}$1${Font}"
  103. }
  104. echo_Yellow(){
  105. echo -e "${Yellow}$1${Font}"
  106. }
  107. echo_GreenBG(){
  108. echo -e "${GreenBG}$1${Font}"
  109. }
  110. # 安装 wg ss v2 脚本开始菜单和必要的wget和curl工具
  111. wget_curl
  112. start_menu