一、安装准备
1. 更新 + 装依赖
dnf update -y
dnf install -y curl wget openssl firewalld
systemctl enable --now firewalld
2. 放行防火墙(443 UDP+TCP)
firewall-cmd --add-port=443/udp --permanent
firewall-cmd --add-port=443/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
二、安装 Hysteria2(官方脚本)
bash <(curl -fsSL https://get.hy2.sh/)
自动下载最新版、创建 systemd 服务
配置文件路径:/etc/hysteria/config.yaml
三、生成自签证书(无域名也能用)
openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) \
-keyout /etc/hysteria/server.key \
-out /etc/hysteria/server.crt \
-subj "/CN=www.microsoft.com" -days 36500
chown hysteria:hysteria /etc/hysteria/server.*
chmod 600 /etc/hysteria/server.key
四、编写 config.yaml
vi /etc/hysteria/config.yaml
内容(格式:缩进用2个空格,:后有一个空格):
listen: :443
tls:
cert: /etc/hysteria/server.crt
key: /etc/hysteria/server.key
auth:
type: password
password: 你的密码 # ← 改成你的强密码
obfs:
type: salamander
salamander:
password: 你的混淆密码 # 抹除协议特征的密码
masquerade:
type: proxy
proxy:
url: https://www.microsoft.com # 伪装成微软
rewriteHost: true
bandwidth:
up: 100 mbps
down: 500 mbps
acl:
inline:
- reject(geoip:cn)
- reject(all, udp/53)
五、启动 + 开机自启
systemctl enable --now hysteria-server
systemctl status hysteria-server
看到 active (running) 就成功。
六、Windows 客户端
1、Hysteria2 官方 Windows 客户端(命令行版)
下载:https://github.com/apernet/hysteria/releases
配置文件(config.yaml,和exe放在一起)
server: 你的VPS_IP:443
auth: 你的密码 #和服务器的一样
obfs:
type: salamander
salamander:
password: 你的混淆密码 #和服务器的一样
tls:
sni: www.microsoft.com
insecure: true
socks5:
listen: 127.0.0.1:50000
双击exe运行,看到 connected 就成;浏览器、系统、其他软件,手动把代理改成 SOCKS5 127.0.0.1:50000 才能走流量 。
2、V2rayN(带界面,推荐新手)
下载:https://github.com/2dust/v2rayN/releases
✅ 配置要点
类型选 Hysteria2
地址:你的 VPS_IP:443
密码:和服务端一致
SNI:www.microsoft.com
勾选跳过证书验证
添加 Hysteria2 节点并启动后,可直接打开系统代理开关,全局流量会自动接管,浏览器、软件无需额外配置代理地址。
3、跳过证书验证,不安全,有下面两种方案升级:
(1)用域名 + 正规 TLS 证书
服务端配置:
listen: :443
acme:
domains:
- hy2.yourdomain.com # 你的域名
email: your@email.com
auth:
type: password
password: 你的密码
官方客户端配置:
server: hy2.yourdomain.com:443
auth: 你的密码 #和服务器的一样
obfs:
type: salamander
salamander:
password: 你的混淆密码 #和服务器的一样
tls:
sni: www.microsoft.com
insecure: false
serverName: hy2.yourdomain.com
socks5:
listen: 127.0.0.1:50000
(2)无域名折中:自签名证书 + 绑定证书指纹(pinSHA256)
生成证书指纹:
openssl x509 -noout -fingerprint -sha256 -in /etc/hysteria/server.crt
输出类似:
SHA256 Fingerprint=AA:BB:CC:DD:...:ZZ
官方客户端配置:
server: 你的VPS_IP:443
auth: 你的密码 #和服务器的一样
obfs:
type: salamander
salamander:
password: 你的混淆密码 #和服务器的一样
tls:
sni: www.microsoft.com
insecure: true
pinSHA256: "AA:BB:CC:DD:...:ZZ" # 上面复制的指纹
socks5:
listen: 127.0.0.1:50000
上一篇:rockylinux9下安装postgresql及常用操作
下一篇:没有了