wulabing / V2Ray_ws-tls_bash_onekey

MIT License
2.09k stars 918 forks source link

【解决办法】安装vless后v2ray service无法启动 #63

Closed jackwon9 closed 1 year ago

jackwon9 commented 1 year ago
vi /etc/systemd/system/v2ray.service

复制粘贴下面内容

[Unit]
Description=V2Ray Service
After=network.target nss-lookup.target

[Service]
User=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
Environment=V2RAY_LOCATION_ASSET=/usr/local/lib/v2ray/
ExecStart=/usr/local/bin/v2ray run -config /etc/v2ray/config.json
Restart=on-failure

[Install]
WantedBy=multi-user.target

还有

vi /etc/systemd/system/v2ray@.service

复制粘贴下面内容

[Unit]
Description=V2Ray Service
After=network.target nss-lookup.target

[Service]
User=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
Environment=V2RAY_LOCATION_ASSET=/usr/local/lib/v2ray/
ExecStart=/usr/local/bin/v2ray run -config /etc/v2ray/%i.json
Restart=on-failure

[Install]
WantedBy=multi-user.target

然后

systemctl daemon-reload
systemctl restart v2ray
systemctl status v2ray

查看v2ray service是否运行,运行的话应该能正常使用了

Rainsheep commented 1 year ago

感谢

jkddw commented 11 months ago

非常感谢,解决了问题