简单搭建TUIC服务 简单搭建TUIC服务

1,247次阅读
46 条评论

共计 2904 个字符,预计需要花费 8 分钟才能阅读完成。

本文仅针对 X86-64,系统的话 Ubuntu 和 Debian 一样的。ARM 的自己找相应操作吧(该死的甲骨文换 4、5 张卡都申请不下来)简单搭建 TUIC 服务 简单搭建 TUIC 服务

本教程主要内容来源于:https://lala.im/8424.html 这个教程,根据最新服务器版本做了一点点改动,对此文作者表示感谢。

也大力感谢 surge pro 群里的天心大佬和 luca 对于我这个小白的基础问题的耐心解答

昨天 surge TF 更新了支持 TUIC,对于折腾完 warp+ 的群里来说总算是有新东西可以折腾了。我这个完全的技术小白也试着按照群里大佬的教程弄了一把,虽然有波折,但是最终还是成功了。试着写一个手把手的教程。

折腾前需要准备的:最新版 TF 版的 surge,并且订阅没有过期;有一个 vps,有一个属于你的域名。(一般来说拥有这些东西的都已经不需要看这个教程了,但也不排除有像我这样只会一键 SS-Rust 的白痴吧)

建立服务端

进入 ssh,输入指令获取管理员权限

sudo -i

然后依次输入:

升级服务器

apt -y update

获取申请证书的 certbot

apt -y install wget certbot

建立服务器端的文件夹并进入该文件夹

mkdir /opt/tuic && cd /opt/tuic

获取服务器端程序

wget https://github.com/EAimTY/tuic/releases/download/0.8.5/tuic-server-0.8.5-x86_64-linux-gnu

赋予服务器端程序权限

chmod +x tuic-server-0.8.5-x86_64-linux-gnu

这里每一行是一条指令,输入后按回车等执行完再进行下一条命令

建立服务器端配置:

nano config.json

(有些 vps 可能默认没有 nano,那么就需要安装 nano 了,具体的方式可以自行搜索:nano 安装)

写入如下配置:

{ 
"port": 想要的端口, 
"token": ["你的密码"], 
"certificate": "/opt/tuic/fullchain.pem", 
"private_key": "/opt/tuic/privkey.pem", 
"ip": "0.0.0.0", "congestion_controller": "bbr", "alpn": ["h3"] 
}


新建 systemd 配置文件

nano /lib/systemd/system/tuic.service

写入如下配置:

[Unit]
Description=Delicately-TUICed high-performance proxy built on top of the QUIC protocol
Documentation=https://github.com/EAimTY/tuic
After=network.target

[Service]
User=root
WorkingDirectory=/opt/tuic
ExecStart=/opt/tuic/tuic-server-0.8.5-x86_64-linux-gnu -c config.json
Restart=on-failure
RestartPreventExitStatus=1
RestartSec=5

[Install]
WantedBy=multi-user.target

至此其实服务器端已经建立好了。如果你已经之前玩过 trojan 有证书的话就直接把证书放入到 /opt/tuic 文件夹里按照上面的配置公钥命名为:fullchain.pem,私钥命名为:private.pem 那么就已经完成了。如果没有的话就接着往下看,通过 certbot 申请证书吧

申请证书:

certbot certonly \
--standalone \
--agree-tos \
--no-eff-email \
--email [email protected] \
-d your.com

这里注意就是要把整个指令先复制到其它文本编辑器里面,把里面的:[email protected] 换成你的邮箱,your.com 换成你的域名,换好后再复制到 ssh app 里面按下回车执行

将获得的证书放到服务器配置文件内的位置:(把里面的 your.com 换成你自己的域名)

cat /etc/letsencrypt/live/your.com/fullchain.pem > /opt/tuic/fullchain.pem
cat /etc/letsencrypt/live/your.com/privkey.pem > /opt/tuic/privkey.pem

注意上面是两条指令,分别执行。

启动 tuic 服务并设置开机自启:

systemctl enable --now tuic.service

至此服务器端的配置已经全部完成了。你在 surge 配置里面就可以按照老刘提供的格式进行节点设置了(暂时无 UI 添加节点)如下示意配置格式,1.1.1.1 换成你的 vps 的 IP,端口就是上面 config.json 里面设置的端口,token 后面就是里面设置的密码,sni 后面就是你的域名。

tuic-AWS = tuic, 1.1.1.1, 设置的端口, skip-cert-verify=true, sni=your.com, token= 设置的密码, alpn=h3

因为 certbot 申请的证书有期限,所以设置个自动运行的脚本进行自动续期

新建一个 certbot 的 hook 脚本文件,用于让 tuic 重新加载续期后的新证书:

nano /etc/letsencrypt/renewal-hooks/post/tuic.sh

写入如下内容:(把里面的 your.com 换成你自己的域名)

#!/bin/bash
cat /etc/letsencrypt/live/your.com/fullchain.pem > /opt/tuic/fullchain.pem
cat /etc/letsencrypt/live/your.com/privkey.pem > /opt/tuic/privkey.pem
systemctl restart tuic.service

给脚本执行权限:

cd /etc/letsencrypt/renewal-hooks/post
chmod +x tuic.sh

测试续期的情况以及脚本能否正常运行:(里面的 your.com 换成你自己的域名)

certbot renew --cert-name your.com --dry-run

至此服务器端就全部配置完成了。

重启:

systemctl restart tuic

如果想查看服务器状态,用这个指令

systemctl status tuic

卸载:

systemctl stop tuic && rm -rf /opt/tuic

附上 luca 的部署过程,包含 ARM 版的指令

(Tuic 搭建.txt)](https://res.craft.do/user/full/2836ab8f-218e-dbc1-14a1-769cf7733ced/8761C39A-938E-4BE9-878F-6E73A6098858_2/i80l30ydgUv0wSNiUaEPpocOxyw9eY1ABG8DXPcyKY4z/Tuic.txt)

正文完
 
lucky
版权声明:本站原创文章,由 lucky 2023-02-15发表,共计2904字。
转载说明:转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(46 条评论)
2024-05-15 11:05:03 回复

I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

 Windows  Edge  拉脱维亚Riga
2024-06-01 01:21:07 回复

Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

 Windows  Edge  美国加利福尼亚旧金山
2024-07-25 15:46:21 回复

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

 Windows  Edge  美国加利福尼亚旧金山
2024-08-07 15:08:30 回复

buy lasuna for sale – cheap lasuna generic himcolin where to buy

 Windows  Chrome  拉脱维亚Riga
2024-08-21 05:09:18 回复

buy besivance generic – besivance uk sildamax over the counter

 Windows  Chrome  美国宾夕法尼亚
2024-08-23 07:45:08 回复

buy neurontin 600mg generic – azulfidine price where to buy sulfasalazine without a prescription

 Windows  Chrome  美国加利福尼亚旧金山
2024-08-25 15:04:42 回复

order benemid online cheap – probenecid pills order carbamazepine generic

 Windows  Chrome  俄罗斯莫斯科莫斯科
2024-08-28 22:13:38 回复

cost celecoxib 100mg – buy celecoxib 200mg for sale indocin cost

 Windows  Chrome  美国加利福尼亚旧金山
2024-08-29 02:25:03 回复

The dose is aseptically injected by the physician into the CSF shunt reservoir, with the patient in the supine position priligy dosage

 Windows  Chrome  美国加利福尼亚旧金山
2024-08-30 07:54:53 回复

buy mebeverine paypal – buy cilostazol 100mg online order generic pletal 100mg

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-04 18:42:24 回复

order voltaren online cheap – voltaren 50mg us buy aspirin

 Windows  Chrome  荷兰阿姆斯特丹阿姆斯特丹
2024-09-08 06:57:11 回复

cheap rumalaya sale – order shallaki generic endep tablet

 Windows  Chrome  巴西圣保罗圣保罗
2024-09-11 04:17:11 回复

mestinon 60 mg for sale – imuran 25mg price order azathioprine 50mg

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-15 05:48:39 回复

buy diclofenac generic – imdur 20mg oral how to buy nimodipine

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-17 05:55:49 回复

ozobax tablet – piroxicam oral piroxicam without prescription

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-18 15:18:29 回复

casibom guncel giris: casibom guncel giris – casibom guncel giris
casibom guncel giris

 Windows  Chrome  埃及
2024-09-21 02:21:18 回复

buy meloxicam generic – purchase toradol generic generic ketorolac

 Windows  Chrome  美国加利福尼亚旧金山
NormanERAKS
2024-09-21 14:45:17 回复

farmacia online envГ­o gratis: comprar cialis online seguro – farmacia online barata

 Windows  Chrome  埃及
NormanERAKS
2024-09-22 03:14:51 回复

farmacia online 24 horas: comprar cialis online seguro opiniones – farmacia online barata y fiable

 Windows  Chrome  德国法兰克福法兰克福
2024-09-22 13:55:45 回复

buy cyproheptadine 4 mg generic – zanaflex without prescription buy generic zanaflex over the counter

 Windows  Chrome  美国加利福尼亚旧金山
NormanERAKS
2024-09-22 17:57:01 回复

farmacia online madrid: farmacias online seguras en espaГ±a – п»їfarmacia online espaГ±a

 Windows  Chrome  意大利米兰米兰
NormanERAKS
2024-09-23 08:45:49 回复

farmacia online 24 horas: Cialis generico – farmacia online barcelona

 Windows  Chrome  埃及
Edisonnus
2024-09-23 18:55:36 回复

farmacia online senza ricetta: Farmacie on line spedizione gratuita – Farmacie on line spedizione gratuita

 Windows  Chrome  瑞士Zurich
Edisonnus
2024-09-24 02:10:07 回复

farmacie online sicure: Farmacie on line spedizione gratuita – acquisto farmaci con ricetta

 Windows  Chrome  罗马尼亚布加勒斯特
Edisonnus
2024-09-24 09:07:31 回复

acquistare farmaci senza ricetta: Cialis generico controindicazioni – п»їFarmacia online migliore

 Windows  Chrome  埃及
Edisonnus
2024-09-24 16:44:25 回复

pillole per erezioni fortissime: viagra generico – viagra pfizer 25mg prezzo

 Windows  Chrome  瑞士Zurich
PatrickGroms
2024-09-25 01:05:41 回复

acquistare farmaci senza ricetta: BRUFEN 600 bustine prezzo – п»їFarmacia online migliore

 Windows  Chrome  美国加利福尼亚旧金山
PatrickGroms
2024-09-25 08:58:34 回复

comprare farmaci online all’estero: Brufen antinfiammatorio – farmacia online piГ№ conveniente

 Windows  Chrome  意大利米兰米兰

Your point of view caught my eye and was very interesting. Thanks. I have a question for you.

 Windows  Edge  美国新泽西
PatrickGroms
2024-09-26 11:56:08 回复

comprare farmaci online con ricetta: Farmacie che vendono Cialis senza ricetta – farmacie online autorizzate elenco

 Windows  Chrome  埃及
2024-09-26 22:08:40 回复

where can i buy trihexyphenidyl – buy emulgel emulgel order online

 Windows  Chrome  美国加利福尼亚旧金山
PatrickGroms
2024-09-27 05:19:08 回复

acquisto farmaci con ricetta: farmacia online migliore – Farmacia online miglior prezzo

 Windows  Chrome  埃及
ArnoldnaH
2024-09-28 02:08:15 回复

ventolin canadian pharmacy: ventolin us price – ventolin cream

 Windows  Chrome  美国加利福尼亚旧金山
Josephtiz
2024-09-29 07:57:52 回复

average cost of prednisone: prednisone 4 mg daily – buy prednisone nz

 Windows  Chrome  意大利米兰米兰
Josephtiz
2024-09-29 19:47:34 回复

can i buy prednisone over the counter in usa: prednisone 0.5 mg – 2.5 mg prednisone daily

 Windows  Chrome  巴基斯坦Punjab
2024-09-30 06:01:25 回复

where to buy cefdinir without a prescription – clindamycin oral cleocin price

 Windows  Chrome  美国佐治亚亚特兰大
TimothyTrode
2024-09-30 14:15:29 回复

medicine in mexico pharmacies: mexican pharmacy – buying prescription drugs in mexico

 Windows  Chrome  意大利米兰米兰
TimothyTrode
2024-10-01 05:51:32 回复

canadian drug: Canadian Pharmacy – drugs from canada

 Windows  Chrome  意大利米兰米兰
2024-10-01 23:48:04 回复

accutane 10mg usa – buy avlosulfon 100mg buy deltasone 5mg sale

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-04 09:51:43 回复

prednisone 5mg ca – order omnacortil 40mg online cheap order zovirax without prescription

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-06 20:54:37 回复

purchase acticin – oral tretinoin cream buy tretinoin cream online

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡
2024-10-10 01:59:54 回复

order betamethasone 20 gm – betnovate canada monobenzone usa

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-11 20:45:17 回复

purchase flagyl generic – order metronidazole 200mg sale where to buy cenforce without a prescription

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡

Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.info/en-IN/register-person?ref=UM6SMJM3

 Windows  Edge  美国加利福尼亚旧金山
2024-10-15 11:01:34 回复

clavulanate usa – buy augmentin 1000mg generic cheap levothyroxine tablets

 Windows  Chrome  美国加利福尼亚旧金山

Your article helped me a lot, is there any more related content? Thanks!

 Windows  Edge  美国加利福尼亚旧金山