作者:
绝缘体.. 发布:
2017-12-13 03:29 分类:
首页 阅读:
抢沙发
搭建shadowsocks很简单,直接yum安装即可。
http://blog.csdn.net/fffy2366/article/details/43710369
安装相关组件
1
|
yum install -y
gcc automake autoconf libtool make
|
2
|
yum install -y
curl-devel zlib-devel openssl-devel perl-devel expat-devel gettext-devel
|
通过github安装shadowsocks
1
|
git
clone https://github.com/madeye/shadowsocks-libev.git
|
创建开机脚本
1
|
vi /etc/init.d/shadowsocks #填写下方脚本
|
003
|
#
Script to run Shadowsocks in daemon mode at boot time.
|
004
|
#
ScriptAuthor: icyboy
|
005
|
#
Revision 1.0 – 14th Sep 2013
|
006
|
#====================================================================
|
007
|
#
Run level information:
|
008
|
#
chkconfig: 2345 99 99
|
009
|
#
Description: lightweight secured scoks5 proxy
|
010
|
#
processname: ss-server
|
011
|
#
Author: Max Lv <max.c.lv@gmail.com>;
|
012
|
#
Run “/sbin/chkconfig –add shadowsocks” to add the Run levels.
|
013
|
#====================================================================
|
015
|
#====================================================================
|
016
|
#
Paths and variables and system checks.
|
018
|
#
Source function library
|
019
|
. /etc/rc.d/init.d/functions
|
021
|
#
Check that networking is up.
|
023
|
[
${NETWORKING} =”yes” ]
|| exit 0
|
026
|
NAME=shadowsocks-server
|
027
|
DAEMON=/usr/local/bin/ss-server
|
029
|
#
Path to the configuration file.
|
031
|
CONF=/etc/shadowsocks/config.json
|
036
|
#
Take care of pidfile permissions
|
037
|
mkdir /var/run/$NAME
2>/dev/null || true
|
038
|
#chown
“$USER:$GROUP” /var/run/$NAME
|
040
|
#
Check the configuration file exists.
|
042
|
if [
! -f $CONF ] ; then
|
043
|
echo “The
configuration file cannot be found!”
|
047
|
#
Path to the lock file.
|
049
|
LOCK_FILE=/var/lock/subsys/shadowsocks
|
051
|
#
Path to the pid file.
|
053
|
PID=/var/run/$NAME/pid
|
056
|
#====================================================================
|
058
|
#====================================================================
|
063
|
#
Start shadowsocks as daemon.
|
066
|
if [
-f $LOCK_FILE ]; then
|
067
|
echo “$NAME
is already running!”
|
070
|
echo -n
$”Starting
${NAME}: ”
|
071
|
#daemon
–check $DAEMON –user $USER “$DAEMON -f $PID -c $CONF > /dev/null&ququot;
|
072
|
daemon
$DAEMON -c $CONF -f $PID
|
076
|
[
$RETVAL -eq 0
] && success
|
078
|
[
$RETVAL -eq 0
] && touch $LOCK_FILE
|
086
|
echo -n
$”Shutting
down ${NAME}: ”
|
096
|
#
See how we were called.
|
109
|
if [
-f $LOCK_FILE ]; then
|
120
|
echo $”Usage:
$0 {start|stop|restart|condrestart|status}”
|
创建config.json并填写相关账号信息
1
|
mkdir -p /etc/shadowsocks
|
2
|
vi /etc/shadowsocks/config.json #填写下方参数
|
04
|
“local_address”: “127.0.0.1”,
|
06
|
“password”:”mypassword”,
|
08
|
“method”:”aes-256-cfb”,
|
各个字段的意思:
字段名
|
含义
|
server
|
服务端监听的地址,服务端可填写 0.0.0.0
|
server_port
|
服务端的端口
|
local_address
|
本地端监听的地址
|
local_port
|
本地端的端口
|
password
|
用于加密的密码
|
timeout
|
超时时间,单位秒
|
method
|
默认 “aes-256-cfb”,参见加密方法
|
fast_open
|
是否使用 TCP_FASTOPEN, true / false
|
workers
|
worker 数量,Unix/Linux 可用,如果不理解含义请不要改
|
最后赋予shadowsocks执行权限并添加开机启动即可
1
|
chmod 755 /etc/init.d/shadowsocks
|
2
|
chkconfig
–add shadowsocks
|
3
|
systemctl
start shadowsocks
|
使用说明:https://github.com/clowwindy/shadowsocks/wiki
https://github.com/madeye/shadowsocks-libev
转载地址:http://miefen.com/201410/how-to-install-shadowsocks-on-centos-7
打赏

微信扫一扫,打赏作者吧~
本文固定链接:
https://www.cxy163.net/archives/1585 |
绝缘体
最活跃的读者