有很多方法可以实现科学上网,如果你有一台VPS,可以自己搭建一个Shadowsocks服务端。自己搭建服务可以更好地对服务端进行控制。这里以Shadowsocks-libev为例介绍安装过程。

服务器系统:CentOS 7.6
版本:Shadowsocks-libev
安装方式:repository






服务端

Github
https://github.com/shadowsocks
https://github.com/shadowsocks/shadowsocks-libev
Repository
https://copr.fedoraproject.org/coprs/librehat/shadowsocks/
实际地址
https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo

安装

[[email protected] ~]# wget https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo
[[email protected] ~]# ll
-rw-r--r--. 1 root root 346 Dec 30 13:33 librehat-shadowsocks-epel-7.repo
[[email protected] ~]# cp librehat-shadowsocks-epel-7.repo /etc/yum.repos.d/
[[email protected] ~]# ll /etc/yum.repos.d/
-rw-r--r--. 1 root root 346 Dec 30 13:34 librehat-shadowsocks-epel-7.repo
[[email protected] ~]# yum update
[[email protected] ~]# yum install shadowsocks-libev
Resolving Dependencies
--> Running transaction check
---> Package shadowsocks-libev.x86_64 0:3.2.0-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved ===========================================================================
Package Arch Version Repository Size
Installing:
shadowsocks-libev x86_64 3.2.0-2.el7 librehat-shadowsocks 260 k

Install 1 Package
Total download size: 260 k
Installed size: 1.0 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/librehat-shadowsocks/packages/shadowsocks-libev-3.2.0-2.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 753d8f08: NOKEY
Public key for shadowsocks-libev-3.2.0-2.el7.x86_64.rpm is not installed
shadowsocks-libev-3.2.0-2.el7.x86_64.rpm
| 260 kB 00:00:00
Retrieving key from https://copr-be.cloud.fedoraproject.org/results/librehat/shadowsocks/pubkey.gpg
Importing GPG key 0x753D8F08:
Userid : "librehat_shadowsocks (None) "
Fingerprint: 260e 3142 3f6f dcfd e43b 1f86 f876 b86a 753d 8f08
From : https://copr-be.cloud.fedoraproject.org/results/librehat/shadowsocks/pubkey.gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : shadowsocks-libev-3.2.0-2.el7.x86_64
1/1
Verifying : shadowsocks-libev-3.2.0-2.el7.x86_64
1/1
Installed:
shadowsocks-libev.x86_64 0:3.2.0-2.el7
Complete!
[[email protected] ~]#

配置

[[email protected] ~]# systemctl status shadowsocks-libev
● shadowsocks-libev.service - Shadowsocks-libev Default Server Service
Loaded: loaded (/usr/lib/systemd/system/shadowsocks-libev.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:shadowsocks-libev(8)
[[email protected] ~]#
[[email protected] ~]# ll /etc/shadowsocks-libev/
total 4
-rw-r--r--. 1 root root 159 Nov 8 02:56 config.json
[[email protected] ~]# cat /etc/shadowsocks-libev/config.json
{
"server":"127.0.0.1",
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"timeout":60,
"method":"chacha20-ietf-poly1305"
}
[[email protected] ~]#
[[email protected] ~]# vim /etc/shadowsocks-libev/config.json
{
"server":"34.34.34.34",
"server_port":8888,
"localaddress":"127.0.0.1",
"local_port":6666,
"password":"abc",
"timeout":600,
"method":"aes-256-cfb"
}


[[email protected] ~]# systemctl start shadowsocks-libev.service
[[email protected] ~]# systemctl enable shadowsocks-libev.service
Created symlink from /etc/systemd/system/multi-user.target.wants/shadowsocks-libev.service to /usr/lib/systemd/system/shadowsocks-libev.service.
[[email protected] ~]# systemctl status shadowsocks-libev
● shadowsocks-libev.service - Shadowsocks-libev Default Server Service
Loaded: loaded (/usr/lib/systemd/system/shadowsocks-libev.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2019-01-04 20:26:32 CST; 7s ago
Docs: man:shadowsocks-libev(8)
Main PID: 2969 (ss-server)
CGroup: /system.slice/shadowsocks-libev.service
└─2969 /usr/bin/ss-server -c /etc/shadowsocks-libev/config.json -u
Jan 04 20:26:32 blog systemd[1]: Started Shadowsocks-libev Default Server Service.
Jan 04 20:26:32 blog ss-server[2969]: 2019-01-04 20:26:32 INFO: UDP relay enabled
Jan 04 20:26:32 blog ss-server[2969]: 2019-01-04 20:26:32 INFO: initializing ciphers… aes-256-cfb
Jan 04 20:26:32 blog ss-server[2969]: 2019-01-04 20:26:32 INFO: tcp server listening at 34.34.34.34:8888
Jan 04 20:26:32 blog ss-server[2969]: 2019-01-04 20:26:32 INFO: udp server listening at 34.34.34.34:8888
[[email protected] ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 34.34.34.34:8888 0.0.0.0:* LISTEN 2969/ss-server

[[email protected] ~]# firewall-cmd --add-port=8888/tcp --permanent
success
[[email protected] ~]# firewall-cmd --reload
success
[[email protected] ~]# firewall-cmd --list-port
8888/tcp

客户端

Windows

Windows客户端下载地址
https://github.com/shadowsocks/shadowsocks-windows

客户端不用安装,直接运行,
服务器地址即服务器端的”server”:”34.34.34.34″
服务器端口即服务器商的”server_port”:8888
代理端口任意

client_windows_1
client_windows_1
client_windows_2
client_windows_2
client_windows_3
client_windows_3
client_windows_4
client_windows_4

手机

Android手机客户端下载地址
https://github.com/shadowsocks/shadowsocks-android

参考资料

shadowsocks网站:https://shadowsocks.org/en/index.html
Windwdows客户端本地下载:Shadowsocks-4.1.3.1

0 Comments

发表评论

电子邮件地址不会被公开。 必填项已用*标注