一、安装 Shadowsocks
yum install python-setuptools && easy_install pip
#apt-get install python-gevent python-pip python-m2crypto
pip install shadowsocks

二、建立配置文件,密码是 135246,端口为55555
cat < /etc/shadowsocks.json
{
“server":"0.0.0.0″,
“server_port":55555,
“local_port":1080,
“password":"135246″,
“timeout":600,
“method":"aes-256-cfb"
}
EOF

三、配置服务
cat < /etc/init.d/shadowsocks
#!/bin/sh
NAME=shadowsocks
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/bin/ssserver
DAEMON_OPTS="-c /etc/shadowsocks.json"
start() {
echo -n “Starting daemon: “$NAME
touch $PIDFILE
chown root:root $PIDFILE
start-stop-daemon –make-pidfile –background –start –quiet –pidfile $PIDFILE –chuid root:root –exec $DAEMON — $DAEMON_OPTS || true
echo “."
}

stop() {
echo -n “Stopping daemon: “$NAME
start-stop-daemon –stop –quiet –oknodo –pidfile $PIDFILE || true
echo “."
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
echo -n “Restarting daemon: “$NAME
stop
sleep 1
start
;;
*)
echo “Usage: “$1″ {start|stop|restart}"
exit 1
esac
exit 0
EOF

四、配置和启动服务端
chmod +x /etc/init.d/shadowsocks
update-rc.d shadowsocks defaults
/etc/init.d/shadowsocks start

=================
yum install m2crypto

To run in the foreground:

ssserver -c /etc/shadowsocks.json
To run in the background:

ssserver -c /etc/shadowsocks.json -d start
ssserver -c /etc/shadowsocks.json -d stop

=================
#!/bin/bash
if
ps -ef|grep “shadowsocks on"|grep -v “grep"
then
echo “Running!"
else
echo “Stopped!"
nohup /opt/shadowsocks-libuv/server > /dev/null 2>&1 &
fi
======================