系统相关
首页 > 系统相关> > centos8建shdow

centos8建shdow

作者:互联网

部署

sudo dnf install -y epel-release
sudo dnf update -y
sudo dnf install -y snapd
sudo systemctl enable --now snapd.socket
sudo apt update && apt upgrade -y
sudo apt install -y snapd
sudo dnf install -y haveged
sudo reboot
sudo snap install shadowsocks-libev
sudo mkdir -p /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev
sudo touch /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json
sudo cat > /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json << EOF
{
   "server":["[::0]", "0.0.0.0"],
   "mode":"tcp_and_udp",
   "server_port":443, #改成服务器防火墙中开启的端口
   "password":"your-secure-password",#设置密码
   "timeout":60,
   "method":"chacha20-ietf-poly1305",#需要安装这种加密方式
   #"method":"aes-256-gcm"也可以
   "nameserver":"8.8.8.8"
}
EOF
sudo touch /etc/systemd/system/shadowsocks-libev-server@.service
sudo cat > /etc/systemd/system/shadowsocks-libev-server@.service << EOF
[Unit]
Description=Shadowsocks-Libev Custom Server Service for %I
Documentation=man:ss-server(1)
After=network-online.target
    
[Service]
Type=simple
ExecStart=/usr/bin/snap run shadowsocks-libev.ss-server -c /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/%i.json
    
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now shadowsocks-libev-server@config
#sudo systemctl restart --now shadowsocks-libev-server@config
sudo systemctl status shadowsocks-libev-server@config

成功后会看到

[root@ip-172-31-2-172 ~]# systemctl status shadowsocks-libev-server@config
● shadowsocks-libev-server@config.service - Shadowsocks-Libev Custom Server Service for config
   Loaded: loaded (/etc/systemd/system/shadowsocks-libev-server@.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-12-16 03:37:49 UTC; 4min 12s ago
     Docs: man:ss-server(1)
 Main PID: 5477 (ss-server)
    Tasks: 1 (limit: 4758)
   Memory: 1.6M
   CGroup: /system.slice/system-shadowsocks\x2dlibev\x2dserver.slice/shadowsocks-libev-server@config.service
           └─5477 /snap/shadowsocks-libev/508/bin/ss-server -c /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json

Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal systemd[1]: Stopped Shadowsocks-Libev Custom Server Service for config.
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal systemd[1]: Started Shadowsocks-Libev Custom Server Service for config.
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: UDP relay enabled
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: initializing ciphers... chacha20-ietf-poly1305
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: using nameserver: 8.8.8.8
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: tcp server listening at [::0]:8080
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: tcp server listening at 0.0.0.0:8080
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: udp server listening at [::0]:8080
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: udp server listening at 0.0.0.0:8080
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal snap[5477]:  2020-12-16 03:37:49 INFO: running from root user

安装chacha20-ietf-poly1305

dnf install gcc make -y
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar zxf LATEST.tar.gz && cd libsodium-stable
./configure 
make && make install
echo $? #输出0表示安装成功

参考

标签:03,16,shdow,49,37,shadowsocks,172,centos8
来源: https://blog.csdn.net/qq_26884501/article/details/111253704