admin

Centos 8 安装配置 shadowsocks
1、安装和启用EPEL Repositoryyum update -ydnf install epel-relea...
扫描右侧二维码阅读全文
04
2020/10

Centos 8 安装配置 shadowsocks

1、安装和启用EPEL Repository

yum update -y
dnf install epel-release -y

2、安装snap
通过snap来安装应用可以运行在单独的环境不影响主机系统。

yum install snapd
snap refresh

添加snap启动通信 socket

systemctl enable --now snapd.socket

创建链接(snap软件包一般安装在/snap目录下)

ln -s /var/lib/snapd/snap /snap

3、安装shadowsocks-libev稳定版

snap install shadowsocks-libev

这一步如果出现error: too early for operation, device not yet seeded or device model not acknowledged,稍微等一两分钟再试

4、建立shadowsocks-libev配置文件

vi /snap/bin/config.json

注意:配置文件位置变了,不同于直接安装时 /etc/shadowsocks/config.json

输入以下内容:

{
    "server":"139.64.236.1",
    "server_port":13010,
    "local_port":1080,
    "password":"FGFsksaGHJ238",
    "timeout":300,
    "method":"aes-256-gcm"
}

5、建立shadowsocks-libev的service单元配置文件

vi /lib/systemd/system/ss.service

输入以下内容:
[Unit]
Description=Shadowsocks Server
After=network.target

[Service]
Restart=on-abnormal
ExecStart=/snap/bin/shadowsocks-libev.ss-server -c /snap/bin/config.json > /dev/null 2>&1

[Install]
WantedBy=multi-user.target

6、设置开机启动shadowsocks-libev

systemctl daemon-reload

systemctl start ss.service

systemctl enable ss.service

  1. 防火墙开放shadowsocks-libev服务端口:

firewall-cmd --permanent --add-port=自定义服务端口/tcp

firewall-cmd --permanent --add-port=自定义服务端口/udp

firewall-cmd --reload

  1. 常用操作
    停止shadowsocks-libev服务

systemctl stop ss.service
取消shadowsocks-libev开机自启

systemctl disable ss.service
升级shadowsocks-libev版本

snap refresh shadowsocks-libev
移除shadowsocks-libev应用(还需要手工清理上文第四节第五节涉及的配置文件)

snap remove shadowsocks-libev

Last modification:April 15th, 2021 at 01:56 pm
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment