侧边栏壁纸
  • 累计撰写 82 篇文章
  • 累计创建 56 个标签
  • 累计收到 2 条评论

目 录CONTENT

文章目录

CentOS6 V2ray安装报错found Install daemon fail, please install it manually

修仙大佬
2020-02-03 / 0 评论 / 0 点赞 / 11 阅读 / 2,154 字 / 正在检测是否收录...

官方安装脚本:

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

记得防火墙放行服务端口

查看配置

cat /etc/v2ray/config.json

0

评论区