A-A+

~什么都不服就是扶墙~

2019年06月27日 19:02 学习笔记 暂无评论 阅读 68 views 次

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】

以下是搭建SS教程,包含服务器端和客户端部分。


服务器环境

  • 服务器地址:港服或外服
  • 服务器版本:CentOS 7.x
  • 带宽:1Mbps

<服务器端配置,均在Linux命令行中执行>


查看系统版本

 cat /etc/redhat-release

安装pip:

1,首先安装epel扩展源:

yum -y install epel-release

2,更新完成之后,就可安装pip:

yum -y install python-pip

3, 安装完成之后清除cache:

yum clean all

4, 升级pip到最新版本:

pip install --upgrade pip

安装配置 shadowsocks

1, pip 安装 python 版本的 shadowsocks

pip install shadowsocks

2, 安装完成后,需要创建shadowsocks的配置文件/etc/shadowsocks.json,编辑内容如下:

vim /etc/shadowsocks.json
//此处进入vim文件编辑
{
  "server": "0.0.0.0",//这里不用改,全0代表地服务器监所有可用网络。
  "server_port": 6356,//服务器端口号,1025到65535任选一。
  "password": "mima123321",//设置登录密码。
  "method": "rc4-md5"//加密方式。
}
  • vim打开配置文件后,按“i“”键可以编辑。编辑完成后按“ESC”,输入“:wq”即可保存退出。不小心按了ctrl+s的话,按ctrl+q解开。不会用的话可以百度一下vim的用法,很容易理解。
  • server设置为公网IP可能会报错,写0.0.0.0就可以,一般服务器都配置为全0。
  • method为加密方法,可选aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4-md5, chacha20, salsa20, rc4, table等。客户端与服务器必须使用一致的加密方式。

配置自启动

1, 编辑启动脚本:

vim /etc/systemd/system/shadowsocks.service
# 这里进入vim文件编辑
# 脚本内容如下:
[Unit]
Description=Shadowsocks

[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json

[Install]
WantedBy=multi-user.target

2, 启动 shadowsocks 服务:

systemctl enable shadowsocks
systemctl start shadowsocks

3, 查看状态:

systemctl status shadowsocks -l

这如果显示active(running)就表示服务器配置成功。没有成功的话可以返回“安装配置shadowsocks”的第2步开始认真按介绍再来一次。
启动成功后的状态信息
4, 配置安全组
我这里使用的是阿里云服务器,所以在服务器管理界面添加安全组规则,如下配置,然后确认,至此服务器端已大功告成。

曾经VPS使用命令历史记录

sudo yum install wget
# 下载包:
wget https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz
# 解压到/usr/local/go
tar -C /usr/local -xzf go1.9.1.linux-amd64.tar.gz
# 导入到系统环境变量
export PATH=$PATH:/usr/local/go/bin
wget --no-check-certificate https://raw.githubusercontent.com/iMeiji/shadowsocks_install/master/shadowsocks-go.sh
chmod +x shadowsocks-go.sh
./shadowsocks-go.sh 2>&1 | tee shadowsocks-go.log
iptables -I INPUT -p tcp --dport 8989 -j ACCEPT
vim /etc/rc.local
vim /etc/sysctl.conf
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
vim /etc/shadowsocks/config.json
ps -ef | grep 8843
ps -ef | grep 8443
reboot
ip a
history
more /etc/shadowsocks/config.json
firewall-cmd
firewall-cmd --list-all
firewall-cmd --list-ports
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
netstat -anp
more /etc/shadowsocks/config.json
firewall-cmd --list-ports
firewall-cmd --zone=public --add-port=443/tcp --permanent
systemctl status firewalld.service
systemctl restart  firewalld.service
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
iptables -L -n | grep 8989
iptables -I INPUT -p tcp --dport 8989 -j ACCEPT
iptables -L -n | grep 8989
ls
cd Python-3.7.3/
l;s
ps -ef
ps -ef |grep make
make install
python3 -V
yum install libffi-devel -y
make install
python3 -V
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
python3 -V
 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
pip3
pip3 -V
pip3 install  git+https://github.com/shadowsocks/shadowsocks.git@master
pip3 install --upgrade pip
pip3 install  git+https://github.com/shadowsocks/shadowsocks.git@master
yum install git
pip3 install  git+https://github.com/shadowsocks/shadowsocks.git@master
more /etc/shadowsocks/config.json
ssserver -c /etc/shadowsocks.json
pip3 install  git+https://github.com/shadowsocks/shadowsocks.git@master
pwd
cd
vi .bash_profile
source .bash_profile
ps -ef|grep shadow
kill 3581
pip
dnf install libsodium python34-pip
python3 -V
pip3 install  git+https://github.com/shadowsocks/shadowsocks.git@master
python -V
ll /usr/bin/python*
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
ls
tar -xvJf   Python-3.7.3.tar.xz
cd Python-3.7.3/
./configure prefix=/usr/local/python3
make
which ssserver
/usr/local/python3/bin/ssserver -c /etc/shadowsocks.json --log-file=/tmp/                                                                                                             shadowsocks.log -d start
vi /etc/shadowsocks.json
more /etc/shadowsocks/config.json
vi /etc/shadowsocks.json
/usr/local/python3/bin/ssserver -c /etc/shadowsocks.json --log-file=/tmp/                                                                                                             shadowsocks.log -d start
more /etc/rc.local
vi /etc/rc.local
more /etc/shadowsocks.json
history |grep fire
firewall-cmd --zone=public --add-port=1521/tcp --permanent
systemctl restart  firewalld.service
ls
mkdir github
cd /opt/
;l
mkdir xssor
cd xssor/
cd ..
rm -rf xssor/
git clone git clone https://github.com/evilcos/xssor2
git clone https://github.com/evilcos/xssor2
cd
cd -
ls
cd xssor2/
ls
vi xssor/payload/probe.js
ls
more requirement.txt
pip install requirement.txt
pip -V
pip2 -V
which pip
pip
find / |grep pip |more
find / |grep pip2 |more
find / |grep pip$ |more
which pip
find / |grep pip$ |more
python -V
find / -name "pip3"
find / -name "pip"
cd
wget --no-check-certificate https://github.com/pypa/pip/archive/9.0.3.tar.gz && wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
find / -name "pip"
find / -name "pip2"
pip -V
pip2 -V
cd -
ls
pip2 install -r requirement.txt
python manage.py runserver 0.0.0.0:8000
vi xssor/payload/probe.js
python manage.py runserver 0.0.0.0:8000
vi xssor/payload/probe.js
python manage.py runserver 0.0.0.0:80
vi xssor/payload/probe.js
python manage.py runserver 0.0.0.0:8000
vi xssor/payload/probe.js
history |grep fire
firewall-cmd --zone=public --add-port=8000/tcp --permanent
systemctl restart  firewalld.service
python manage.py runserver 0.0.0.0:8000
nohup python manage.py runserver 0.0.0.0:8000  >web.log & disown
ls
tail -f web.log
ls
vi manage.py
ls
more uwsgi.ini
cd xssor/
ls
grep "log"
grep "log"  *
vi urls.py
ls
vi settings.py
cd payload/
ls
more html5sec.json
ls
cd
ls
exit
netstat -anp |grep python
ls
exit
ps -ef|grep python
kill 21134
ps -ef|grep python
kill 21139
ps -ef|grep python
ls
exit
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
vi settings.py
vim /etc/shadowsocks/config.json
/etc/init.d/shadowsocks restart
ps -ef
more /etc/rc.local
ps -ef|grep python
ps -ef
kill 28056
more /etc/rc.local
/usr/local/python3/bin/ssserver -c /etc/shadowsocks.json --log-file=/tmp/shadowsocks.log -d start
ps -ef
ll /usr/bin/shadowsocks-server
w
history |more
more /etc/shadowsocks/config.json
firewall-cmd --list-ports
history

布施恩德可便相知重

微信扫一扫打赏

支付宝扫一扫打赏

×

给我留言