自己写的垃圾脚本,本地测试通过
输出结果那里借鉴了秋水大佬的代码,在此表示感谢
采用的是v2ray官方的镜像
github在这里:https://github.com/isoftosyuri/share

  • red='\033[0;31m'
  • green='\033[0;32m'
  • yellow='\033[0;33m'
  • plain='\033[0m'
  • - [[ $EUID -ne 0 ]] && echo -e "[${red}Error${plain}] This script must be run as root!" && exit 1
  • - base_port=shuf -i 10000-50000 -n 1
  • function set_port_number()
  • {
  • #auto find suitable port
  • lsof -Pi :$base_port -sTCP:LISTEN && \
  • base_port=$(($base_port+1)) && \
  • set_port_number
  • }
  • - function env_check(){
  • curl --help > /dev/null 2>&1 || (apt update -y && apt install -y curl || yum update -y && yum update -y curl)
  • docker ps > /dev/null 2>&1 || (curl -sSL https://get.docker.io | sh > /dev/null 2>&1 && echo "Installing Docker...")
  • docker ps > /dev/null 2>&1 || service docker start > /dev/null 2>&1
  • mkdir -p /etc/v2ray
  • str=cat /proc/sys/kernel/random/uuid
  • cat > /etc/v2ray/config.json /dev/null 2>&1
  • get_info
  • }
  • - install_v2ray(){
  • run
  • clear
  • echo
  • echo -e "${yellow}Congratulations, v2ray${software[0]}${yellow} server install completed!${plain}"
  • echo -e "Your Server IP : ${green} ${ip} ${plain}"
  • echo -e "Your Server Port : ${green} ${base_port} ${plain}"
  • echo -e "Your Password : ${green} ${password} ${plain}"
  • echo -e "Your Encryption Method: ${green} ${encryption_method} ${plain}"
  • echo
  • }
  • - install_v2ray复制代码