Skip to content

Instantly share code, notes, and snippets.

@yvdjee
Forked from m-tana/softether-x64.sh
Last active April 19, 2018 16:06
Show Gist options
  • Save yvdjee/dbab6421b1e5b830e174d914dac4f25f to your computer and use it in GitHub Desktop.
Save yvdjee/dbab6421b1e5b830e174d914dac4f25f to your computer and use it in GitHub Desktop.
Softether Script for x86_64 CentOS
#!/bin/bash
yum groupinstall "Development Tools" &&
# Define softether version
RTM=$(curl http://www.softether-download.com/files/softether/ | grep -o 'v[^"]*e' | grep rtm | tail -1)
IFS='-' read -r -a RTMS <<< "${RTM}"
# Get softether source
wget "http://www.softether-download.com/files/softether/${RTMS[0]}-${RTMS[1]}-${RTMS[2]}-${RTMS[3]}-${RTMS[4]}/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-${RTMS[0]}-${RTMS[1]}-${RTMS[2]}-${RTMS[3]}-linux-x64-64bit.tar.gz" -O /tmp/softether-vpnserver.tar.gz &&
# Extract softether source
tar -xzvf /tmp/softether-vpnserver.tar.gz -C /usr/local/ &&
# Remove unused file
rm /tmp/softether-vpnserver.tar.gz &&
# Move to source directory
cd /usr/local/vpnserver
make &&
chmod 600 * &&
chmod 700 vpnserver &&
chmod 700 vpncmd &&
cat <<EOT >> /etc/init.d/vpnserver
#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/usr/local/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
test -x $DAEMON || exit 0
case "$1" in
start)
$DAEMON start
touch $LOCK
;;
stop)
$DAEMON stop
rm $LOCK
;;
restart)
$DAEMON stop
sleep 3
$DAEMON start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
EOT
chmod 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start &&
chkconfig --add vpnserver
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment