Centos 6下安装不了v2ray,提示Install daemon fail, please install it manually
-
请填写你的广告代码,或者删除本行文字。
这一段为官方原话
V2Ray 在以下平台中可用:
Windows 7 及之后版本(x86 / amd64);
Mac OS X 10.10 Yosemite 及之后版本(amd64);
Linux 2.6.23 及之后版本(x86 / amd64 / arm / arm64 / mips64 / mips);
包括但不限于 Debian 7 / 8、Ubuntu 12.04 / 14.04 及后续版本、CentOS 6 / 7、Arch Linux;
FreeBSD (x86 / amd64);
OpenBSD (x86 / amd64);
Dragonfly BSD (amd64)
运行下面的指令下载并安装 V2Ray。当 yum 或 apt-get 可用的情况下,此脚本会自动安装 unzip 和 daemon。这两个组件是安装 V2Ray 的必要组件。如果你使用的系统不支持 yum 或 apt-get,请自行安装 unzip 和 daemon
此脚本会自动安装以下文件:
/usr/bin/v2ray/v2ray:V2Ray 程序;
/usr/bin/v2ray/v2ctl:V2Ray 工具;
/etc/v2ray/config.json:配置文件;
/usr/bin/v2ray/geoip.dat:IP 数据文件
/usr/bin/v2ray/geosite.dat:域名数据文件
此脚本会配置自动运行脚本。自动运行脚本会在系统重启之后,自动运行 V2Ray。目前自动运行脚本只支持带有 Systemd 的系统,以及 Debian / Ubuntu 全系列。
运行脚本位于系统的以下位置:
/etc/systemd/system/v2ray.service: Systemd
/etc/init.d/v2ray: SysV
脚本运行完成后,你需要:
编辑 /etc/v2ray/config.json 文件来配置你需要的代理方式;
运行 service v2ray start 来启动 V2Ray 进程;
之后可以使用 service v2ray start|stop|status|reload|restart|force-reload 控制 V2Ray 的运行。
go.sh 支持如下参数,可在手动安装时根据实际情况调整:
-p 或 --proxy: 使用代理服务器来下载 V2Ray 的文件,格式与 curl 接受的参数一致,比如 "socks5://127.0.0.1:1080" 或 "http://127.0.0.1:3128"。
-f 或 --force: 强制安装。在默认情况下,如果当前系统中已有最新版本的 V2Ray,go.sh 会在检测之后就退出。如果需要强制重装一遍,则需要指定该参数。
--version: 指定需要安装的版本,比如 "v1.13"。默认值为最新版本。
--local: 使用一个本地文件进行安装。如果你已经下载了某个版本的 V2Ray,则可通过这个参数指定一个文件路径来进行安装。
示例:
使用地址为 127.0.0.1:1080 的 SOCKS 代理下载并安装最新版本:./go.sh -p socks5://127.0.0.1:1080
安装本地的 v1.13 版本:./go.sh --version v1.13 --local /path/to/v2ray.zip
问题来了
V2ray官方安装脚本只支持Debian7,Debian8、9和CentOS7系列。
可是很多Linux服务器却还是运行着CentOS6系列。
如果直接运行v2ray官方的安装脚本bash <(curl -L -s https://install.direct/go.sh)
那么会像下面报错
Updating software repo
/dev/fd/63: line 119: apt-get: command not found
Installing daemon
/dev/fd/63: line 124: apt-get: command not found
Install daemon fail, please install it manually
问题就是安装脚本在创建守护服务的时候不支持CentOS6
解决办法
将下述代码保存为/etc/init.d/v2ray,并添加执行权限。#!/bin/sh # # v2ray Startup script for v2ray # # chkconfig: - 24 76 # processname: v2ray # pidfile: /var/run/v2ray.pid # description: V2Ray proxy services # ### BEGIN INIT INFO # Provides: v2ray # Required-Start: $network $local_fs $remote_fs # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: V2Ray proxy services # Description: V2Ray proxy services ### END INIT INFO DESC=v2ray NAME=v2ray DAEMON=/usr/bin/v2ray/v2ray PIDFILE=/var/run/$NAME.pid LOCKFILE=/var/lock/subsys/$NAME SCRIPTNAME=/etc/init.d/$NAME RETVAL=0 DAEMON_OPTS="-config /etc/v2ray/config.json" # Exit if the package is not installed [ -x $DAEMON ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Source function library. . /etc/rc.d/init.d/functions start() { local pids=$(pgrep -f $DAEMON) if [ -n "$pids" ]; then echo "$NAME (pid $pids) is already running" RETVAL=0 return 0 fi echo -n $"Starting $NAME: " mkdir -p /var/log/v2ray $DAEMON $DAEMON_OPTS 1>/dev/null 2>&1 & echo $! > $PIDFILE sleep 2 pgrep -f $DAEMON >/dev/null 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ]; then success; echo touch $LOCKFILE else failure; echo fi return $RETVAL } stop() { local pids=$(pgrep -f $DAEMON) if [ -z "$pids" ]; then echo "$NAME is not running" RETVAL=0 return 0 fi echo -n $"Stopping $NAME: " killproc -p ${PIDFILE} ${NAME} RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE} } reload() { echo -n $"Reloading $NAME: " killproc -p ${PIDFILE} ${NAME} -HUP RETVAL=$? echo } rh_status() { status -p ${PIDFILE} ${DAEMON} } # See how we were called. case "$1" in start) rh_status >/dev/null 2>&1 && exit 0 start ;; stop) stop ;; status) rh_status RETVAL=$? ;; restart) stop start ;; reload) reload ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|reload|restart}" >&2 RETVAL=2 ;; esac exit $RETVAL
加入开机启动,开启服务,问题彻底解决
chmod a+x /etc/init.d/v2ray chkconfig v2ray on service v2ray start
查看配置文件 /etc/v2ray/config.json
参考tcp配置文件(随机无特征的游戏协议流量){ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port": 23000, "protocol": "vmess", "settings": { "clients": [ { "id": "da5c5b2d-06ca-4363-9b4d-3a9e23ce291d", "level": 1, "alterId": 64 } ] }, "streamSettings": { "network": "tcp" }, "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } } //include_ss //include_socks //include_mtproto //include_in_config // ], "outbounds": [ { "protocol": "freedom", "settings": {} }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" }, { "protocol": "freedom", "settings": {}, "tag": "direct" }, { "protocol": "mtproto", "settings": {}, "tag": "tg-out" } //include_out_config // ], "dns": { "server": [ "8.8.8.8", "1.1.1.1", "localhost" ] }, "routing": { "domainStrategy": "IPOnDemand", "rules": [ { "type": "field", "ip": [ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "blocked" }, { "type": "field", "inboundTag": ["tg-in"], "outboundTag": "tg-out" } //include_ban_ad //include_rules // ] }, "transport": { "kcpSettings": { "uplinkCapacity": 100, "downlinkCapacity": 100, "congestion": false }, "sockopt": { "tcpFastOpen": true } } }
查看配置文件 /etc/v2ray/config.json
kcp模式配置文件,伪装视频聊天流量(速度快,如果收到错误包会被干扰无法使用){ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port": 23000, "protocol": "vmess", "settings": { "clients": [ { "id": "da5c5b2d-06ca-4363-9b4d-3a9e23ce291d", "level": 1, "alterId": 64 } ] }, "streamSettings": { "network": "kcp", "kcpSettings": { "header": { "type": "wechat-video" } } }, "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } } //include_ss //include_socks //include_mtproto //include_in_config // ], "outbounds": [ { "protocol": "freedom", "settings": {} }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" }, { "protocol": "freedom", "settings": {}, "tag": "direct" }, { "protocol": "mtproto", "settings": {}, "tag": "tg-out" } //include_out_config // ], "dns": { "server": [ "8.8.8.8", "1.1.1.1", "localhost" ] }, "routing": { "domainStrategy": "IPOnDemand", "rules": [ { "type": "field", "ip": [ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "blocked" }, { "type": "field", "inboundTag": ["tg-in"], "outboundTag": "tg-out" } //include_ban_ad //include_rules // ] }, "transport": { "kcpSettings": { "uplinkCapacity": 100, "downlinkCapacity": 100, "congestion": false }, "sockopt": { "tcpFastOpen": true } } }
查看配置文件 /etc/v2ray/config.json
ws模式配置文件,伪装工商银行网站访问(更可靠不会被运营商qos){ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port": 80, "protocol": "vmess", "settings": { "clients": [ { "id": "da5c5b2d-06ca-4363-9b4d-3a9e23ce291d", "level": 1, "alterId": 64 } ] }, "streamSettings": { "network": "ws" }, "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } } //include_ss //include_socks //include_mtproto //include_in_config // ], "outbounds": [ { "protocol": "freedom", "settings": {} }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" }, { "protocol": "freedom", "settings": {}, "tag": "direct" }, { "protocol": "mtproto", "settings": {}, "tag": "tg-out" } //include_out_config // ], "dns": { "server": [ "8.8.8.8", "1.1.1.1", "localhost" ] }, "routing": { "domainStrategy": "IPOnDemand", "rules": [ { "type": "field", "ip": [ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "blocked" }, { "type": "field", "inboundTag": ["tg-in"], "outboundTag": "tg-out" } //include_ban_ad //include_rules // ] }, "transport": { "kcpSettings": { "uplinkCapacity": 100, "downlinkCapacity": 100, "congestion": false }, "sockopt": { "tcpFastOpen": true } } }
修改后重启生效
service v2ray restart
根据日志查看启动情况
cat /var/log/v2ray/error.log | grep started
或者查看启动进程
top -b -n 1 |grep v2ray
报错无法连接分析
tail -f /var/log/v2ray/access.log
2019/06/02 21:29:35 我的本地ip:5235 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
2019/06/02 21:29:35 我的本地ip:5237 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
2019/06/02 21:29:36 我的本地ip:5239 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
2019/06/02 21:29:37 我的本地ip:5241 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
2019/06/02 21:29:38 我的本地ip:5242 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
2019/06/02 21:29:40 我的本地ip:5244 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
2019/06/02 21:29:41 我的本地ip:5250 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
可能的原因:
客户端和服务器端的用户 ID 不匹配;
客户端和服务器端的用户 alterId 不匹配;
客户端与服务器的时间不匹配,误差不能超过90秒钟;
这个原因检查下防火墙是否关闭dial tcp ip:19695: i/o timeout
推荐阅读
文章标签:
版权声明: 本文除特别说明外均由 超级火箭 原创
本文链接: https://superrocket.net/jishu/6.html,尊重共享,欢迎转载,请自觉添加本文链接,谢谢!
分享本文: 请填写您的分享代码。
呃 本文暂时没人评论 来添加一个吧
发表评论