Oops!该文章已被删除

Centos7搭建Shadowsocks

搭建shadowsocks很简单,直接yum安装即可。 安装相关组件 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 2 cd shadowsocks-libev 3 ./configure && make 4 make install 创建开机脚本 1 vi /etc/init.d/shadowsocks   #填写下方脚本 001 #!/bin/bash 002 # 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 ; 012 # Run "/sbin/chkconfig --add shadowsocks" to add the Run levels. 013 #==================================================================== 014 015 #==================================================================== 016 # Paths and variables and system checks. 017 018 # Source function library 019 . /etc/rc.d/init.d/functions 020 021 # Check that networking is up. 022 # 023 [ ${NETWORKING} ="yes" ] || exit 0 024 025 # Daemon 026 NAME=shadowsocks-server 027 DAEMON=/usr/local/bin/ss-server 028 029 # Path to the configuration file. 030 # 031 CONF=/etc/shadowsocks/config.json 032 033 #USER="nobody" 034 #GROUP="nobody" 035 036 # Take care of pidfile permissions 037 mkdir /var/run/$NAME 2>/dev/null || true 038 #chown "$USER:$GROUP" /var/run/$NAME 039 040 # Check the configuration file exists. 041 # 042 if [ ! -f $CONF ] ; then 043 echo "The configuration file cannot be found!" 044 exit 0 045 fi 046 047 # Path to the lock file. 048 # 049 LOCK_FILE=/var/lock/subsys/shadowsocks 050 051 # Path to the pid file. 052 # 053 PID=/var/run/$NAME/pid 054 055 056 #==================================================================== 057 058 #==================================================================== 059 # Run controls: 060 061 RETVAL=0 062 063 # Start shadowsocks as daemon. 064 # 065 start() { 066 if [ -f $LOCK_FILE ]; then 067 echo "$NAME is already running!" 068 exit 0 069 else 070 echo -n $"Starting ${NAME}: " 071 #daemon --check $DAEMON --user $USER "$DAEMON -f $PID -c $CONF > /dev/null" 072 daemon $DAEMON -c $CONF -f $PID 073 fi 074 075 RETVAL=$? 076 [ $RETVAL -eq 0 ] && success 077 echo 078 [ $RETVAL -eq 0 ] && touch $LOCK_FILE 079 return $RETVAL 080 } 081 082 083 # Stop shadowsocks. 084 # 085 stop() { 086 echo -n $"Shutting down ${NAME}: " 087 killproc -p ${PID} 088 RETVAL=$? 089 [ $RETVAL -eq 0 ] 090 rm -f $LOCK_FILE 091 rm -f ${PID} 092 echo 093 return $RETVAL 094 } 095 096 # See how we were called. 097 case "$1" in 098 start) 099 start 100 ;; 101 stop) 102 stop 103 ;; 104 restart) 105 stop 106 start 107 ;; 108 condrestart) 109 if [ -f $LOCK_FILE ]; then 110 stop 111 start 112 RETVAL=$? 113 fi 114 ;; 115 status) 116 status $DAEMON 117 RETVAL=$? 118 ;; 119 *) 120 echo $"Usage: $0 {start|stop|restart|condrestart|status}" 121 RETVAL=1 122 esac 123 124 exit $RETVAL 创建config.json并填写相关账号信息 1 mkdir -p /etc/shadowsocks 2 vi /etc/shadowsocks/config.json  #填写下方参数 01 { 02     "server":"服务器 IP 地址", 03     "server_port":8388, 04     "local_address": "127.0.0.1", 05     "local_port":1080, 06     "password":"mypassword", 07     "timeout":300, 08     "method":"aes-256-cfb", 09     "fast_open": false, 10     "workers": 1 11 } 各个字段的意思: 字段名 含义 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   本文标题:Centos7搭建Shadowsocks 使用说明:https://github.com/clowwindy/shadowsocks/wiki                https://github.com/madeye/shadowsocks-libev 本文地址:https://miefen.com/201410/how-to-install-shadowsocks-on-centos-7本文来自:小龙的博客,原地址:https://xl.cndyun.com/post/177.html

原文链接:https://miefen.com/201410/how-to-install-shadowsocks-on-centos-7

编辑于

小龙的博客

0 篇文章1 人订阅

扫码关注云+社区