SS-Panel+SS-Manyuser安装部署

安装相关程序环境

1
2
3
4
5
6
7
8
9
10
sudo apt-get install php5
sudo apt-get install curl
sudo apt-get install php5-curl
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt-get install python
sudo apt-get install python-pip git python-m2crypto
pip install cymysql

Clone位于GitHub上的manyuser项目的Repo

cd /home/shangxin
mkdir www
git clone https://github.com/YoungSx/shadowsocks-manyuser.git backen
https://github.com/orvice/ss-panel/releases下载Latest release的包,解压到www

数据库操作

登陆mysql

1
mysql -u root -p

执行以下两条SQL语句,1是创建shadowsocks数据库,2是创建一个ss用户密码为22222,并赋予权限

1
2
CREATE DATABASE IF NOT EXISTS shadowsocks DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON shadowsocks.* TO 'ss'@'localhost' IDENTIFIED BY '22222'; #Table:shadowsocks UserName:ss UserPassword:22222 AllowedHost:localhost (如果允许别的主机连接此数据库的话,localhost改成%)

导入数据库

1
2
USE shadowsocks
SOURCE /home/shangxin/www/sql/*.sql(数个.sql文件)

配置数据库信息
将 lib/config-sample.php 重命名为 config.php,并编辑数据库信息.
加密方式改为2
当使用新的加密方式「带salt的sha256」加密,由于每个站点的$salt值都不同,所以初始密码「1993」是没有用的,安装完成后,访问/pwd.php?pwd=密码
得到的字符串是encode后的密码,需要插入到数据库中

1
update user set pass="加密后的密码字符串",email="你的邮箱" where email="first@blood.com";

安装各种依赖

1
2
3
cd /home/shangxin/www
curl -sS https://getcomposer.org/installer | php
php composer.phar install

ManyUser配置

1
2
gedit /home/shangxin/www/backend/shadowsocks/Config.py
python server.py

使用supervisor进程守护
安装supervisor

1
apt-get install python-pip python-m2crypto supervisor

编辑文件

1
gedit /etc/supervisor/conf.d/shadowsocks.conf

输入(dir路径记得修改,路径千万不要多空格!!!)

1
2
3
4
[program:shadowsocks]
command=python /home/shangxin/www/backend/shadowsocks/server.py -c /home/shangxin/www/backend/shadowsocks/config.json
autorestart=true
user=root

启动

1
2
service supervisor start
supervisorctl reload

修改以下文件
/etc/profile
/etc/default/supervisor

1
2
3
4
结尾各添加3行
ulimit -n 51200
ulimit -Sn 4096
ulimit -Hn 8192

debug查看日志

1
supervisorctl tail -f shadowsocks stderr

启动/重启/停止

1
2
3
supervisorctl start shadowsocks
supervisorctl restart shadowsocks
supervisorctl stop shadowsocks

Apache2的配置

1
2
sudo gedit /etc/apache2/sites-available/000-default.conf
sudo gedit /etc/apache2/apache2.conf

加入Include httpd.conf

根目录改成 /home/shangxin/www/
/etc/apache2/目录下新建httpd.conf,文件内容“ServerName localhost”

1
2
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql

重启Apache2

1
sudo /etc/init.d/apache2 restart

Mysql远程访问解决方案:
1 在目标服务器上(192.168.1.11),修改mysql的my.cnf文件:
sudo vi /etc/mysql/my.cnf
2 注释掉bind-address,屏蔽其只对本地监听

1
#bind-address = 127.0.0.1

3 启动MySQL服务,使其修改的配置生效

1
sudo restart mysql

参考:
https://github.com/orvice/ss-panel
https://github.com/mengskysama/shadowsocks/tree/manyuser
踩过的坑:
http://stackoverflow.com/questions/32264309/errors-while-using-a-laravel-5-boilerplate
http://www.2cto.com/os/201308/238996.html
http://blogsit.iteye.com/blog/1944415
https://www.zmrbk.com/post-2583.html
http://www.111cn.net/sys/202/47318.htm

不知道 >_< 本站总访问量