1、第一步我们来安装服务需要的一些依赖服务:
[root@Sh_Test ~]# yum -y install gcc gcc-c++ automake make pam-devel openldap-devel cyrus-sasl-devel openssl-devel
2、在 SS5 官网下载SS5最新版本的源代码 SS5官网地址:http://ss5.sourceforge.net/ 这里目前可以下载的最新版链接如下:(由于文件服务器在国内没有节点,下载可能会比较慢) https://jaist.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
[root@Sh_Test ~]# wget https://jaist.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
3、解压、编译源码安装ss5服务
[root@Sh_Test ~]# tar zxf ss5-3.8.9-8.tar.gz -C /usr/local/
[root@Sh_Test ~]# cd /usr/local/ss5-3.8.9/
[root@Sh_Test ss5-3.8.9]#
./configure && make && make install
4、启动服务(启动脚本默认没有执行权限,需要手动赋权)
[root@Sh_Test ~]#
/etc/rc.d/init.d/ss5 start
-bash:
/etc/rc.d/init.d/ss5:
权限不够
[root@Sh_Test ~]# ll /etc/rc.d/init.d/ss5
-rw-r--r--
1 root root 1613
7月
12
16:28
/etc/rc.d/init.d/ss5
[root@Sh_Test ~]# chmod 744
/etc/rc.d/init.d/ss5
[root@Sh_Test ~]#
/etc/rc.d/init.d/ss5 start
Reloading systemd:
[
确定
]
Starting ss5 (via systemctl):
[
确定
]
5、两种模式配置
a、无用户认证模式: 启用 ss5.conf 配置文件中的下列两行配置:
[root@Sh_Test ~]# egrep -v '^#|^$'
/etc/opt/ss5/ss5.conf
auth 0.0.0.0/0
-
-
permit -
0.0.0.0/0
-
0.0.0.0/0
-
-
-
-
-
验证: (linux下使用 curl 命令加 –socks5 参数指定代理地址访问)
root@BJ-CentOS7
~
# curl myip.ipip.net
当前 IP:123.206.14.147
来自于:中国
天津
天津
电信/联通/移动
root@BJ-CentOS7
~
# curl myip.ipip.net --socks5 118.89.106.69:1080
当前 IP:118.89.106.69
来自于:中国
上海
上海
电信/联通/移动
b、用户密码认证方式 修改 ss5.conf 配置文件中的下列两行配置,ss5.passwd中添加用户密码,每行一对用户+密码,使用空间隔开
[root@Sh_Test ~]# egrep -v '^#|^$'
/etc/opt/ss5/ss5.conf
auth 0.0.0.0/0
- u
permit u 0.0.0.0/0
-
0.0.0.0/0
-
-
-
-
-
[root@Sh_Test ~]# cat /etc/opt/ss5/ss5.passwd
test test
[root@Sh_Test ~]# systemctl restart ss5
验证: (linux下使用 curl 命令加 –socks5 参数指定代理地址访问) 此时不指定用户密码的情况下无法正常使用代理地址做请求:
root@BJ-CentOS7
~
# curl myip.ipip.net --socks5 118.89.106.69:1080
curl:
(7)
No authentication method was acceptable.
(It
is quite likely that the SOCKS5 server wanted a username/password, since none was supplied to the server on this connection.)
root@BJ-CentOS7
~
# curl myip.ipip.net
当前 IP:123.206.14.147
来自于:中国
天津
天津
电信/联通/移动
root@BJ-CentOS7
~
# curl myip.ipip.net --socks5 test:test@118.89.106.69:1080
当前 IP:118.89.106.69
来自于:中国
上海
上海
电信/联通/移动
注意:安装完成后的配置文件位置不在安装目录下,而是在/etc/opt/ss5目录下,只有这个位置下得文件生效
客户机全局使用:
export http_proxy=socks5://test:test@xxx:1080
export http_proxy=socks5://test:test@xxx:1080