通过ss-panelv3调用shadowsocks-go管理多用户
时间:2016-04-27 来源: 作者: 条评论
由于SS-panel V3增加了一些功能,但是调用传统的shadowsocks manyuser无法实现一些功能,所以可以通过shadowsocks-go来实现这些功能,下面是整理的一些安装信息。
ss-panelv3安装基本上很简单,需求git组件,默认Centos6带的是1.7.1但是不利于后文ss-go的安装,所以我们这里直接编译安装最新的版本,截止到文章是2.2.1.如果你之前已经用yum install git 命令安装了老版本,那么需要先卸载
yum remove gityum openssl-develyum expat-develyum gettext-develyum asciidocyum xmltoyum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel //检查是否有遗漏
># wget https://github.com/git/git/archive/v2.2.1.tar.gz># tar zxvf v2.2.1.tar.gz># cd git-2.2.1># make configure># ./configure –prefix=/usr/local/git –with-iconv=/usr/local/libiconv># make all doc># make install install-doc install-html># echo “export PATH=$PATH:/usr/local/git/bin” >> /etc/bashrc# source /etc/bashrc
| wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz |
| tar xzvf git–latest.tar.gz |
| cd git–2011–11–30 #你的目录可能不是这个 |
| autoconf |
| ./configure |
| make |
| sudo make install |
查看版本号
># git –version# git –version >git version 2.2.1
Step 0
git clone https://github.com/orvice/ss-panel.git //下载程序包
Step 1
$ curl -sS https://getcomposer.org/installer | php //获取composer包 $ php composer.phar install //安装
Step 2
cp .env.example .env /更改配置文件
chmod -R 777 storage //更改权限
Step 3
Step 4
root /home/www/ss-panel/public; location / { try_files $uri $uri/ /index.php$is_args$args; }
Step 5
Step 6
vim .env
Auth Driver 认证设置
- cookie 同v2的认证方式,不推荐。
- redis 使用Redis存储,推荐此方式。
安装Redis
如果你是使用lnmp搭建的网站环境,进入lnmp解压后的目录,执行:./addons.sh install redis 来安装。很方便。 如果是centos 使用 yum install redis
密码加密方式
- md5 不推荐
- sha256 推荐
添加管理员
php xcat createAdmin
重置流量
php xcat resetTraffic
注意
wget -c https://storage.useso.com/golang/go1.6.linux-amd64.tar.gz //根据你的系统版本选择相应的环境包tar -C /usr/local -xzf go1.6.linux-amd64.tar.gzexport PATH=$PATH:/usr/local/go/binexport GOPATH=~/.go
go get github.com/orvice/shadowsocks-go 或者使用 git clone git://github.com/orvice/shadowsocks-gocd ~/.go/src/github.com/orvice/shadowsocks-go/mugo getgo buildcp example.conf ~/.go/bin/config.confvim ~/.go/bin/config.conf[base]
N 1
ip 0.0.0.0
client webapi
checktime 60
synctime 60[webapi]
url http://xxxxx.com/mu /你的域名,后面别忘了跟mu
key xxxx 你的ss-panel .env文件的key秘钥
node_id 1[mysql]
host 127.0.0.1:3306
user user
pass pass
db db
table table[redis]
host localhost:6379
# if no passwd set,comment this line
#pass “” //这里注释掉
#db 1
cd ~/.go/bin/./mu
./mu -debug
easy_install supervisor运行
echo_supervisord_conf测试是否安装成功。创建配置文件:
echo_supervisord_conf > /etc/supervisord.conf修改配置文件:
在supervisord.conf最后增加:
[program:shadowsocks]
command = /root/.go/bin/mu
directory = /root/.go/bin/
user=root
autostart=true
autorestart=true
stderr_logfile = /var/log/shadowsocks.log
stdout_logfile = /var/log/shadowsocks.log
startsecs=3
/usr/bin/supervisord -c /etc/supervisord.conf-c 表示配置文件的路径,读取这里个配置文件,之前也是可以根据自己的情况放在不同的文件夹下
修改配置文件之后:supervisorctl reload 重载 服务重新启动
debug查看连接日志:
supervisorctl tail -f shadowsocks stderr #Ctrl+C 取消查看设置supervisord开机启动
编辑文件:vi /etc/rc.local
在末尾另起一行添加supervisord,保存退出(和上文类似)。
另centos7还需要为rc.local添加执行权限
chmod +x /etc/rc.local
至此运用supervisord控制shadowsocks开机自启和后台运行设置完成
常用命令
控制命令基本都通过supervisorctl执行,输入help可以看到命令列表。这是一些常用命令:
获得所有程序状态 supervisorctl status
关闭目标程序 supervisorctl stop shadowsocks
启动目标程序 supervisorctl start shadowsocks
关闭所有程序 supervisorctl shutdown
vim ~/.bashrc
alias xxxxx=’supervisorctl tail -f shadowsocks stderr’ //这里的xxxxx是你自定义的命令,只要不和已有的命令冲突即可。
source ~/.bashrc //直接把命令导入到我们的环境中
