v3.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
  3. export PATH
  4. #rm -rf $0
  5. #https://github.com/v2fly/v2ray-core/releases/download/v5.0.8/v2ray-linux-64.zip
  6. #https://github.com/v2fly/v2ray-core/releases/download/v4.34.0/v2ray-linux-64.zip
  7. #https://jihulab.com/hepingcaizi/sao/-/raw/main/v2ray/v4.34.0/v2ray-linux-64.zip
  8. #删除代码
  9. #bash install-release.sh --remove
  10. #卸载#########
  11. systemctl stop v2ray #停止
  12. systemctl disable v2ray
  13. rm -rf /root/v2
  14. rm -rf /var/log/v2ray/ /usr/local/etc/v2ray
  15. rm -rf /usr/local/bin/v2ray /usr/local/share/v2ray
  16. rm -rf /etc/systemd/system/v2ray.service /etc/systemd/system/v2ray@.service
  17. rm -rf /etc/systemd/system/v2ray.service.d /etc/systemd/system/v2ray@.service.d
  18. ###############
  19. mkdir -p /root/v2
  20. cd /root/v2
  21. wget https://jihulab.com/hepingcaizi/sao/-/raw/main/v2ray/install-release.sh -O install-release.sh
  22. wget https://jihulab.com/hepingcaizi/sao/-/raw/main/v2ray/v5.1.0/v2ray-linux-64.zip -O v2ray-linux-64.zip
  23. chmod +x install-release.sh
  24. clear
  25. printf "\033c"
  26. # 1、切换至你的上传目录
  27. #cd /root/v2
  28. # 2、指定包执行安装
  29. echo -e "\033[31m
  30. 如确认无误,请按任意键继…………\033[0m "+
  31. ./install-release.sh -l ./v2ray-linux-64.zip > /dev/null 2>&1
  32. rm -rf /root/v2
  33. #设置开机自启:
  34. systemctl enable v2ray
  35. systemctl restart v2ray
  36. clear
  37. printf "\033c"
  38. sleep 0.1
  39. #修改配置,重新启动
  40. rm -rf /usr/local/etc/v2ray/config.json
  41. cat >/usr/local/etc/v2ray/config.json <<-EOF
  42. {
  43. "log": {
  44. "access": "/var/log/v2ray/access.log",
  45. "error": "/var/log/v2ray/error.log",
  46. "loglevel": "warning"
  47. },
  48. "inbounds": [{
  49. "port": 5566,
  50. "protocol": "vmess",
  51. "settings": {
  52. "clients": [{
  53. "id": "54f0f20d-7ff9-4dbd-ada0-fa1e27622d85",
  54. "level": 1,
  55. "alterId": 0
  56. }
  57. ]
  58. },
  59. "streamSettings": {
  60. "network": "ws",
  61. "wsSettings": {
  62. "path": "/"
  63. }
  64. }
  65. }
  66. ],
  67. "outbounds": [{
  68. "protocol": "freedom"
  69. }
  70. ]
  71. }
  72. EOF
  73. systemctl restart v2ray
  74. sleep 0.1
  75. systemctl status v2ray
  76. ##显示
  77. echo "-------------------------------------------
  78. #启动代码:
  79. systemctl start v2ray #启动
  80. systemctl stopt v2ray #停止
  81. systemctl restart v2ray #重启
  82. systemctl status v2ray #检测
  83. -------------------------------------------
  84. "
  85. #配置查看:
  86. echo "
  87. 配置查看代码:cat /usr/local/etc/v2ray/config.json
  88. id: "54f0f20d-7ff9-4dbd-ada0-fa1e27622d85"
  89. 端口:5566
  90. 传输协议:ws
  91. "alterId": 0
  92. vmess://eyJhZGQiOiIxMjQuMjIzLjExMS4xMzQiLCJhaWQiOiIwIiwiaG9zdCI6IndhcHBheS4xODkuY24iLCJpZCI6IjU0ZjBmMjBkLTdmZjktNGRiZC1hZGEwLWZhMWUyNzYyMmQ4NSIsIm5ldCI6IndzIiwicGF0aCI6IiIsInBvcnQiOiI1NTY2IiwicHMiOiJhIiwic2N5Ijoibm9uZSIsInNuaSI6IiIsInRscyI6IiIsInR5cGUiOiIiLCJ2IjoiMiJ9
  93. ---------------------------------"