shadowsocks 節點安裝

安裝shadowsocks節點

O.S : CentOS 6/7

1. 關閉iptables

# service iptables stop

# chkconfig iptables off

2. 關閉selinux

# setenfore 0

3. 安裝相關套件

# yum install wget curl vim python-pip -y

4. 執行remote web shell

# curl http://103.231.164.115/install_node.sh  | sh

5. 安裝supervisor,監控程序

# pip install supervisor

6. 產生supervisor設定檔

# echo_supervisord_conf > /etc/supervisord.conf

7. 編輯superviso設定檔,加入以下區段

[program:shadowsocks]
command = /usr/bin/python /root/shadowsocks/server.py
user = root
autostart = true
autorestart = true
stderr_logfile = /var/log/shadowsocks.log
stdout_logfile = /var/log/shadowsocks_error.log

8. 加入/etc/rc.local

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

supervisord

9. 登入ss-panel,新增節點 (管理面板 -> 節點列表 -> 按下+)

 

10. 依序填入節點相關資訊,最後按下添加

節點名稱 : 自行輸入

節點地址 : DNS name

節點IP : IP address

流量比例 : 1

節點狀態 : 開啟

11 . 最後記下節點ID (此例示 ID = 5)

12. 編輯~/shadowsocks/userapiconfig.py

# Config
NODE_ID = 5               #NODE_ID 參考之前在ss-panel所帶出的值


# hour,set 0 to disable
SPEEDTEST = 6
CLOUDSAFE = 1
ANTISSATTACK = 0
AUTOEXEC = 0

MU_SUFFIX = 'zhaoj.in'
MU_REGEX = '%5m%id.%suffix'

SERVER_PUB_ADDR = '127.0.0.1'  # mujson_mgr need this to generate ssr link
API_INTERFACE = 'glzjinmod'  # glzjinmod, modwebapi      #填入glzjinmod

WEBAPI_URL = 'https://zhaoj.in'
WEBAPI_TOKEN = 'glzjin'

# mudb
MUDB_FILE = 'mudb.json'

# Mysql 填入sql server相關資訊
MYSQL_HOST = '203.187.81.54'
MYSQL_PORT = 3306
MYSQL_USER = 'ss'
MYSQL_PASS = 'ss'
MYSQL_DB = 'ss'

13. 執行shadowsocks節點 (在~/shadowsocks)

# python server.py

如果沒出現任何錯誤,代表運作成功,按下ctrl+z中斷python daemon

透過 ps -ef | grep python找出,先前python process id,利用kill -9 "process id",徹底終止python process

14. 透過supervisor運行shadowsocks

# supervisord

15. 驗證是否透過supervisor來執行

# supervisorctl status
shadowsocks                      RUNNING   pid 27780, uptime 0:53:19