MXBLOG - x-ui
type: channel
link: https://moonjer.com/category/x-ui/
items: v2rayNG服务端安装

v2rayNG服务端安装
type: item
date: 2021-10-27T21:02:20+08:00
description: 1.运行脚本bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)或#!/bin/bash red='\033[0;31m' green='\033[0;32m' yellow='\033[0;33m' plain='\033[0m' cur_dir=$(pwd) # check root [[ $EUID -ne 0 ]] && echo -e "${red}错误：${plain} 必须使用root用户运行此脚本！\n" && exit 1 # check os if [[ -f /etc/redhat-release ]]; then release="centos" elif cat /etc/issue | grep -Eqi "debian"; then release="debian" elif cat /etc/issue | grep -Eqi "ubuntu"; then release="ubuntu" elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then release="centos" elif cat /proc/version | grep -Eqi "debian"; then release="debian" elif cat /proc/version | grep -Eqi "ubuntu"; then release="ubuntu" elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then release="centos" else echo -e "${red}未检测到系统版本，请联系脚本作者！${plain}\n" && exit 1 fi arch=$(arch) if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then arch="amd64" elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then arch="arm64" else arch="amd64" echo -e "${red}检测架构失败，使用默认架构: ${arch}${plain}" fi echo "架构: ${arch}" if [ $(getconf WORD_BIT) != '32' ] && [ $(getconf LONG_BIT) != '64' ] ; then echo "本软件不支持 32 位系统(x86)，请使用 64 位系统(x86_64)，如果检测有误，请联系作者" exit -1 fi os_version="" # os version if [[ -f /etc/os-release ]]; then os_version=$(awk -F'[= ."]' '/VERSION_ID/{print $3}' /etc/os-release) fi if [[ -z "$os_version" && -f /etc/lsb-release ]]; then os_version=$(awk -F'[= ."]+' '/DISTRIB_RELEASE/{print $2}' /etc/lsb-release) fi if [[ x"${release}" == x"centos" ]]; then if [[ ${os_version} -le 6 ]]; then echo -e "${red}请使用 CentOS 7 或更高版本的系统！${plain}\n" && exit 1 fi elif [[ x"${release}" == x"ubuntu" ]]; then if [[ ${os_version} -lt 16 ]]; then echo -e "${red}请使用 Ubuntu 16 或更高版本的系统！${plain}\n" && exit 1 fi elif [[ x"${release}" == x"debian" ]]; then if [[ ${os_version} -lt 8 ]]; then echo -e "${red}请使用 Debian 8 或更高版本的系统！${plain}\n" && exit 1 fi fi install_base() { if [[ x"${release}" == x"centos" ]]; then yum install wget cu…