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 *-libev
sudo mkdir -p /var/snap/*-libev/common/etc/*-libev
sudo touch /var/snap/*-libev/common/etc/*-libev/config.json
sudo cat > /var/snap/*-libev/common/etc/*-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/*-libev-server@.service
sudo cat > /etc/systemd/system/*-libev-server@.service << EOF
[Unit]
Description=*-Libev Custom Server Service for %I
Documentation=man:ss-server(1)
After=network-online.target
    
[Service]
Type=simple
ExecStart=/usr/bin/snap run *-libev.ss-server -c /var/snap/*-libev/common/etc/*-libev/%i.json
    
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now *-libev-server@config
#sudo systemctl restart --now *-libev-server@config
sudo systemctl status *-libev-server@config

成功后会看到

[root@ip-172-31-2-172 ~]# systemctl status *-libev-server@config
● *-libev-server@config.service - *-Libev Custom Server Service for config
   Loaded: loaded (/etc/systemd/system/*-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-*\x2dlibev\x2dserver.slice/*-libev-server@config.service
           └─5477 /snap/*-libev/508/bin/ss-server -c /var/snap/*-libev/common/etc/*-libev/config.json

Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal systemd[1]: Stopped *-Libev Custom Server Service for config.
Dec 16 03:37:49 ip-172-31-2-172.us-east-2.compute.internal systemd[1]: Started *-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表示安装成功

参考

上一篇:数据结构排序算法-快速排序


下一篇:MongoDB添加索引