Skip to content

Instantly share code, notes, and snippets.

@theowenyoung
Last active February 14, 2023 13:12
Show Gist options
  • Save theowenyoung/49be1ca9c88095f47c7ab4a7cba9aa77 to your computer and use it in GitHub Desktop.
Save theowenyoung/49be1ca9c88095f47c7ab4a7cba9aa77 to your computer and use it in GitHub Desktop.
Install Gost Service
#!/bin/sh
# must use root
if [ "$(whoami)" != "root" ]; then
echo "must use root"
exit 1
fi
REPO_NAME="ginuerzh/gost"
latest_version=2.11.5
echo start install $REPO_NAME latest v${latest_version}
cd /tmp
curl -O -L https://github.com/$REPO_NAME/releases/download/v${latest_version}/gost-linux-amd64-${latest_version}.gz
gzip -d gost-linux-amd64-$latest_version.gz
mkdir -p ~/bin
mv gost-linux-amd64-$latest_version ~/bin/gost
# add execute permission
chmod +x ~/bin/gost
#!/bin/bash
set -e
# install gost to system service
# must use root
if [ "$(whoami)" != "root" ]; then
echo "must use root"
exit 1
fi
# service
ss_service="$(
cat <<EOF
[Unit]
Description=service
After=network.target
[Service]
Type=simple
ExecStart=%h/bin/gost -L http://:8080
Restart=on-failure
[Install]
WantedBy=default.target
EOF
)"
# write ss_service to /etc/systemd/system/ss.service
echo "$ss_service" >/etc/systemd/system/gost.service
UNIT=gost
systemctl enable $UNIT
systemctl daemon-reload
systemctl restart $UNIT
systemctl status $UNIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment