运维 | v2ray 节点搭建教程

Appleex
Appleex
发布于 2023-05-17 / 1125 阅读
0
0

运维 | v2ray 节点搭建教程

v2ray 节点搭建教程

前言

本章主要记录如何搭建 v2ray 节点,实现科学上网

准备工作

以上提供的内容仅作为参考,请按需选用

快速使用

更新与安装工具包

  • CentOS
yum update -y
yum install -y curl wget socat
  • Ubuntu/Debian
apt update -y
apt install -y curl wget socat

一键安装脚本

bash <(curl -s -L https://git.io/v2ray-setup.sh)

备用脚本:

# 脚本1
bash <(curl -sL https://cdn.jsdelivr.net/gh/Misaka-blog/Xray-script@master/xray.sh)

# 脚本2
bash <(curl -sL https://raw.githubusercontent.com/eujc/v2ray/main/xray.sh)

# 脚本3
bash <(curl -sL https://raw.githubusercontent.com/daveleung/hijkpw-scripts-mod/main/xray_mod1.sh)

注意:当上述脚本失效或无法使用时,可尝试使用备用脚本,但无法保证质量和可行性

申请 SSL 证书

  • 安装并运行 acme.sh 脚本
curl https://get.acme.sh | sh
  • 申请证书及密钥
# 将代码中注释的邮箱和域名,改为你自己的
~/.acme.sh/acme.sh --register-account -m xxxx@gmail.com

~/.acme.sh/acme.sh  --issue -d 输入你的域名  --standalone
  • 下载证书及密钥
~/.acme.sh/acme.sh --installcert -d 输入你的域名 --key-file /root/private.key --fullchain-file /root/cert.crt

BBR 加速

wget --no-check-certificate -q -O bbr2.sh "https://github.com/yeyingorg/bbr2.sh/raw/master/bbr2.sh" && chmod +x bbr2.sh && bash bbr2.sh auto

放行端口

  • CentOS
# 查看已开放的端口
firewall-cmd --list-ports

# 开放端口(开放后需要要重启防火墙才生效)
firewall-cmd --zone=public --add-port=3338/tcp --permanent

# 重启防火墙
firewall-cmd --reload

# 停止防火墙
systemctl stop firewalld
  • Ubuntu & Debian
# 放行80端口
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

# 放行443端口
iptables -I INPUT -p tcp --dport 443 -j ACCEPT

FAQ

结尾

本期的内容就到这里,路过的小伙伴记得支持一下哦!


评论