v2ray-core改造成系统服务
项目地址
https://github.com/v2fly/v2ray-core
官网
https://www.v2fly.org/
创建服务
sudo nano /etc/systemd/system/v2ray.service
写入
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target
[Service]
User=nobody
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
#ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json
ExecStart=/usr/bin/v2ray -config /etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
复制文件
mkdir /etc/v2ray
sudo cp config.json /etc/v2ray/
mkdir /usr/local/share/v2ray
sudo cp geoip.dat /usr/local/share/v2ray/geoip.dat
sudo cp geosite.dat /usr/local/share/v2ray/geosite.dat
sudo cp v2ctl /usr/bin/
sudo cp v2ray /usr/bin/
使用 systemd 命令管理 v2ray 服务
重新加载系统服务
systemctl daemon-reload
启动frp
sudo systemctl start v2ray
停止frp
sudo systemctl stop v2ray
重启frp
sudo systemctl restart v2ray
查看frp状态
sudo systemctl status v2ray
设置 v2ray 开机自启动
sudo systemctl enable v2ray
查看 v2ray 是否开机自启
sudo systemctl is-enabled v2ray