Clash to Clash#
Recently, Clash Meta has updated its core functionality as a server. (Click here to see the official introduction). This time, we will use Meta as the tuic server.
One-click script#
wget https://raw.githubusercontent.com/imbalaomao/tuic-install/main/tuic_clash.sh && bash tuic_clash.sh
Step-by-step setup (for reference only)#
1. Update the system + install necessary services#
apt-get -y update && apt-get -y install wget curl socat net-tools jq
2. Apply for a certificate using acme.sh#
2.1. Install acme.sh#
curl https://get.acme.sh | sh
2.2. Apply for a certificate using acme#
~/.acme.sh/acme.sh --set-default-ca --server letsencrypt && ~/.acme.sh/acme.sh --issue -d your_domain --standalone --install-cert -d your_domain --ecc --fullchain-file /etc/ssl/private/fullchain.cer --key-file /etc/ssl/private/private.key
3. Download the latest version of Clash-meta and extract it#
wget -O /opt/tuic_clash/server.gz $(curl -s https://api.github.com/repos/MetaCubeX/Clash.Meta/releases | jq -r '.[0].assets[13].browser_download_url') && gunzip /opt/tuic_clash/server.gz /opt/tuic_clash/server && chmod +x /opt/tuic_clash/server
4. Configure the server#
First, create the configuration file:
vi /etc/tuic_server.yaml
Then, write the following content:
tuic-server:
enable: true
listen: 0.0.0.0:port_number
users:
generate_a_UUID: custom_password
certificate: /etc/ssl/private/fullchain.cer
private-key: /etc/ssl/private/private.key
congestion-controller: bbr
max-idle-time: 8000
authentication-timeout: 1000
alpn:
- h3
5. Configure the system service#
First, create the systemctl file:
nano /etc/systemd/system/tuic_clash.service
Then, write the following content:
[Unit]
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/opt/tuic_clash/server -f /opt/tuic_clash/server_config.yaml
[Install]
WantedBy=multi-user.target
Finally, enable the system service:
systemctl daemon-reload && systemctl enable --now tuic_clash
Remarks#
- View the running log:
journalctl -u tuic --output cat -e
- Real-time log view:
journalctl -u tuic --output cat -f
Uninstallation Guide#
- Uninstall the system service
systemctl stop tuic_clash && systemctl disable tuic_clash && systemctl daemon-reload
rm -rf /etc/systemd/system/tuic.service
- Delete the running files and configuration files
rm -rf /opt/tuic_clash
- Uninstall acme.sh and delete domain certificates
acme.sh uninstall && rm -rf /root/.acme.sh
rm -rf /root/acme.sh