Forked from zjx20/gist:1c7f4dd1392866f9d8b00dd2a05bd481
Last active
October 10, 2018 16:45
-
-
Save rahimnathwani/b3677d8c6d9a908257fb846e0b78c7cb to your computer and use it in GitHub Desktop.
kcptun install and systemd daemon
This file contains hidden or 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
# wget https://github.com/xtaci/kcptun/releases/download/v20170525/kcptun-linux-amd64-20170525.tar.gz | |
# tar xvf kcptun-linux-amd64-20170525.tar.gz | |
mv server_linux_amd64 /usr/local/bin/kcptun_server | |
mv /usr/local/bin/server_linux_amd64 /usr/local/bin/kcptun_server | |
sudo mkdir -p /etc/kcptun | |
sudo bash -c "cat <<EOT > /etc/kcptun/server_conf.json | |
{ | |
\"listen\": \":21\", | |
\"target\": \"127.0.0.1:20001\", | |
\"mode\": \"normal\", | |
\"dscp\": 46, | |
\"mtu\": 1200, | |
\"crypt\": \"none\", | |
\"nocomp\": true | |
} | |
EOT" | |
sudo bash -c "cat <<EOT > /etc/systemd/system/kcptun_server.service | |
[Unit] | |
Description=Kcptun server | |
Requires=network.target | |
After=network-online.target | |
[Service] | |
Type=simple | |
User=root | |
RemainAfterExit=yes | |
ExecStart=/usr/local/bin/kcptun_server -c /etc/kcptun/server_conf.json | |
ExecReload=/usr/bin/kill -HUP $MAINPID | |
RestartSec=1min | |
Restart=on-failure | |
[Install] | |
WantedBy=multi-user.target | |
EOT" | |
sudo systemctl enable kcptun_server | |
sudo systemctl start kcptun_server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment