Last active
May 24, 2021 06:20
-
-
Save LitileXueZha/e3b0ef77ea136cc5e6dacba8b533fd7c to your computer and use it in GitHub Desktop.
v2ray一键安装脚本
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 | |
# 优先使用官网安装 | |
# 链接:https://v2ray.com/chapter_00/install.html | |
# | |
# 不过已经挂了 -- 2020.09.03 | |
if bash <(curl -L -s https://install.direct/go.sh); then | |
exit 0 | |
fi | |
echo -e "\n****** 改用官方推荐 fhs 版安装 ******\n" | |
# 源仓库地址:https://github.com/v2fly/fhs-install-v2ray | |
FILE="install.sh" | |
LINK_SH_INSTALL="https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh" | |
LINK_CONFIG="https://dl.ningtaostudy.cn/v2ray" | |
FILE_CONFIG="v2ray.json" | |
if ! curl -o "$FILE" "$LINK_SH_INSTALL"; then | |
exit 1 | |
fi | |
# 安装。失败了就直接退出 | |
if ! bash "$FILE"; then | |
echo "安装失败" | |
exit 1 | |
fi | |
rm "$FILE" | |
# 在当前目录下创建软链,方便修改 | |
if [[ ! -f "$FILE_CONFIG" ]]; then | |
ln -s /usr/local/etc/v2ray/config.json "$FILE_CONFIG" | |
fi | |
# 默认配置是空的话,下载自己的配置 | |
if [[ "$(cat $FILE_CONFIG)" == "{}" ]]; then | |
if ! curl -L -s -o "_$FILE_CONFIG" "$LINK_CONFIG"; then | |
echo "下载配置失败" | |
exit 1 | |
fi | |
cat "_$FILE_CONFIG" > "$FILE_CONFIG" | |
rm "_$FILE_CONFIG" | |
fi | |
systemctl enable v2ray | |
systemctl start v2ray | |
###### 一些建议 ###### | |
# 开启 Google BBR。经测试,速度显著加强 | |
if [[ ! "$(lsmod | grep bbr)" ]]; then | |
echo -e "\n建议开启 Google BBR 模块" | |
fi | |
# 可能连不上,打开防火墙端口 | |
firewall-cmd --zone=public --add-port=31375/tcp --permanent | |
systemctl restart firewalld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment