fydy / elaw

:100: 个人博客站,记录一些事。
https://git.io/JWxoK
25 stars 8 forks source link

在 CentOS 7 下安装配置 Shadowsocks #38

Open fydy opened 4 years ago

fydy commented 4 years ago

Shadowsokcks是一款翻墙代理软件,此软件会智能判断所访问网站是否被墙,被墙的网站会通过远端服务器进行访问,但是某些被墙的网站没有及时添加到shadowsocks的数据库中,导致这些网站依然无法访问,或者某些网站在国内可以正常访问,但是速度很慢,希望通过shadowsocks进行加速,我们可以通过手动在本地添加网址的方式解决。下面是基于centos7环境搭建Shadowsocks。

Install the necessary components

sudo yum install epel-release -y
sudo yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y

download shadowsocks-livev repo

sudo wget -P /etc/yum.repos.d/ https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo

install shadowsocks-livev

sudo yum install -y shadowsocks-libev

Create config file

sudo vim /opt/shadowsocks.json

{
    "server": ["[::0]", "0.0.0.0"],
    "server_port": "8088",
    "password": "password",
    "method": "aes-256-cfb"
}

将8088`password 替换为自己的数值,其中password 尽量设置强一点,包含符合,避免被暴力破解。

Create systemctl service

sudo vim /etc/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks

[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ss-server -c /opt/shadowsocks.json

[Install]
WantedBy=multi-user.target

Start and enable the service

sudo systemctl start shadowsocks
sudo systemctl enable shadowsocks
fydy commented 4 years ago

demo