forked from junbaor/shell_script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
centos-shadowsocks.sh
53 lines (41 loc) · 1.26 KB
/
centos-shadowsocks.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
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
####################################
install_home="/etc/shadowsocks/" # 安装目录
port=888; # 端口
password="password" # 密码
encrypt="chacha20-ietf-poly1305" # 加密方式
####################################
systemctl stop firewalld
systemctl disable firewalld
rm -rf $install_home
mkdir -p $install_home
yum update -y
yum -y install epel-release
yum install -y python-pip git gcc gcc-c++ make
pip install --upgrade pip
pip install setuptools
# pip install shadowsocks
pip install git+https://github.com/shadowsocks/shadowsocks.git@master
cd $install_home
cat > $install_home/config.json <<EOF
{
"server":"0.0.0.0",
"server_port":$port,
"password":"$password",
"method":"$encrypt"
}
EOF
wget https://github.com/jedisct1/libsodium/releases/download/1.0.15/libsodium-1.0.15.tar.gz
tar zxvf libsodium-1.0.15.tar.gz
cd libsodium-1.0.15
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
start_cmd="ssserver -c "$install_home"config.json -d start"
$start_cmd
echo 'shadowsocks 服务已启动'
sleep 3
echo $start_cmd >> /etc/rc.local
chmod +x /etc/rc.d/rc.local
echo "安装成功,已加入开机自启,端口:$port 密码:$password 加密方式:$encrypt"