-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstallSS.sh
executable file
·42 lines (35 loc) · 1.05 KB
/
installSS.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Description: install Shadowsocks Server
# Author: tlanyan<https://tlanyan.me>
function checkSystem()
{
result=$(id | awk '{print $1}')
if [ $result != "uid=0(root)" ]; then
echo "action must be carried out by root!"
exit 1
fi
if [ ! -f /etc/centos-release ];then
echo false
return
fi
result=`cat /etc/centos-release|grep "CentOS Linux release 7"`
if [ "$result" = "" ]; then
echo false
fi
echo true
}
function installSS()
{
wget -O /etc/yum.repos.d/librehat-shadowsocks-epel-7.repo 'https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo'
yum install -y shadowsocks-libev
echo 'alias startSS="nohup ss-server -c /etc/shadowsocks-libev/config.json > /dev/null 2>&1 &"' >> ~/.bashrc
echo 'alias stopSS="pkill ss-server"' >> ~/.bashrc
}
result=$(checkSystem)
if [ "$result" != "true" ]; then
echo "scripts only tested on centos 7!"
exit 1
fi
echo -n "system version : "
cat /etc/centos-release
installSS