vultr centos7 python版shadowsocks安装
时间:2016-05-27 02:18 来源:linux.it.net.cn 作者:IT
折腾了好久好久啊,终于装上了,原来是防火墙搞的鬼,下面相详细记录下安装过程,我的centos7系统啊.
1.停用firwalld
1
2
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2.安装iptables
1
2
3
4
5
6
7
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8899 -j ACCEPT //新增
-A INPUT -m state --state NEW -m udp -p udp --dport 8899 -j ACCEPT //新增
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
3.安装各种配置工具
1
2
3
4
5
6
7
8
9
10
11
12
yum install gcc
yum install libevent
yum install python-devel
#安装python的pip包管理
yum install python-setuptools && easy_install pip
pip install gevent
#安装加密工具
yum install openssl-devel
yum install swig
pip install M2Crypto
#安装shadowsocks服务器端
pip install shadowsocks
4.配置shadowsocks
1
2
3
4
5
6
7
8
9
10
11
12
13
# 使用vi新建shadowsocks.json配置文件
vi /etc/shadowsocks.json 粘贴以下代码
# 粘贴下列数据到配置文件中
{
"server":"ip_address",
"server_port":9999,
"local_port":1080,
"password":"password",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"workers": 1
}
5.启动shadowsocks
1
2
3
首先你可以这样启动
nohup ssserver -c /etc/shadowsocks.json > /dev/null 2>&1 &
也可以把以上命令放到/etc/rc.local文件里开机启动
6.终极启动方法
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
vi /etc/init.d/shadowsocks
# 粘贴以下代码
#!/bin/bash
# chkconfig: 2345 90 10
# description: Start or stop the Shadowsocks server
#
### BEGIN INIT INFO
# Provides: Shadowsocks
# Required-Start: $network $syslog
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start or stop the Shadowsocks server
### END INIT INFO
name=shadowsocks
BIN=/usr/bin/ssserver
conf=/etc/shadowsocks.json
start(){
$BIN -c $conf -d start
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo "$name start success"
else
echo "$name start failed"
fi
}
stop(){
pid=`ps -ef | grep -v grep | grep -i "${BIN}" | awk '{print $2}'`
if [[ ! -z $pid ]]; then
$BIN -c $conf -d stop
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo "$name stop success"
else
echo "$name stop failed"
fi
else
echo "$name is not running"
RETVAL=1
fi
}
status(){
pid=`ps -ef | grep -v grep | grep -i "${BIN}" | awk '{print $2}'`
if [[ -z $pid ]]; then
echo "$name is not running"
RETVAL=1
else
echo "$name is running with PID $pid"
RETVAL=0
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'status')
status
;;
'restart')
stop
start
RETVAL=$?
;;
*)
echo "Usage: $0 { start | stop | restart | status }"
RETVAL=1
;;
esac
exit $RETVAL
7.最后的最后(你如果选择第六步的启动方法)那么第七步你也要看
1
2
3
4
5
chmod +x /etc/init.d/shadowsocks
chkconfig --add shadowsocks
chkconfig shadowsocks on
#执行以上3个命令
完事以后你可以通过/etc/init.d/shadowsocks start stop restart来管理你的服务了,并且支持开机启动哦
当然了,你以为就以上这些吗?你当然还要配置你电脑上的shadowsocks了。不必多说了
(责任编辑:IT)
折腾了好久好久啊,终于装上了,原来是防火墙搞的鬼,下面相详细记录下安装过程,我的centos7系统啊. 1.停用firwalld
2.安装iptables
3.安装各种配置工具
4.配置shadowsocks
5.启动shadowsocks
6.终极启动方法
7.最后的最后(你如果选择第六步的启动方法)那么第七步你也要看
当然了,你以为就以上这些吗?你当然还要配置你电脑上的shadowsocks了。不必多说了 (责任编辑:IT) |