jeequan / jeepay

Jeepay是一套适合互联网企业使用的开源支付系统,支持多渠道服务商和普通商户模式。已对接微信支付,支付宝,云闪付官方接口,支持聚合码支付。
https://www.jeequan.com
GNU Lesser General Public License v3.0
5.22k stars 1.79k forks source link

关于ActiveMQ 或 RabbitMQ 或 RocketMQ在linux的安装(一般适用于宝塔用户)(脚本可能有问题)(随便写的) #59

Closed wuchenchina closed 1 year ago

wuchenchina commented 1 year ago
#!/bin/bash

# 检测是否存在JDK8
if [ ! -d "/usr/local/btjdk/jdk8" ]; then
    echo "未找到JDK8,正在安装..."
    yum install -y java-1.8.0-openjdk
else
    echo "在 /usr/local/btjdk/jdk8 找到了JDK8"
fi

# 询问用户选择要安装的MQ
read -p "您想要安装哪种MQ? (ActiveMQ/RabbitMQ/RocketMQ): " choice

case $choice in
    ActiveMQ)
        # 安装ActiveMQ
        echo "正在安装ActiveMQ..."
        wget https://archive.apache.org/dist/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz
        tar xzf apache-activemq-5.16.0-bin.tar.gz
        mv apache-activemq-5.16.0 /opt/activemq
        ;;
    RabbitMQ)
        # 安装RabbitMQ
        echo "正在安装RabbitMQ..."
        yum install -y epel-release
        yum install -y erlang
        yum install -y https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.9/rabbitmq-server-3.7.9-1.el7.noarch.rpm
        systemctl start rabbitmq-server
        systemctl enable rabbitmq-server
        ;;
    RocketMQ)
        # 安装RocketMQ
        echo "正在安装RocketMQ..."
        wget https://archive.apache.org/dist/rocketmq/4.5.0/rocketmq-all-4.5.0-bin-release.zip
        unzip rocketmq-all-4.5.0-bin-release.zip
        mv rocketmq-all-4.5.0-bin-release /opt/rocketmq
        ;;
    *)
        echo "选择无效!"
        exit 1
        ;;
esac

echo "安装完成!"
wuchenchina commented 1 year ago
#!/bin/bash

# 检测是否存在JDK8
if [ ! -d "/usr/local/btjdk/jdk8" ]; then
    echo "未找到JDK8,正在安装..."
    yum install -y java-1.8.0-openjdk
else
    echo "在 /usr/local/btjdk/jdk8 找到了JDK8"
fi

# 询问用户选择要安装的MQ
echo "请选择您想安装的MQ:"
echo "1. ActiveMQ"
echo "2. RabbitMQ"
echo "3. RocketMQ"
read -p "请选择 (1/2/3): " choice

case $choice in
    1)
        # 安装ActiveMQ
        echo "正在安装ActiveMQ..."
        wget https://archive.apache.org/dist/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz
        tar xzf apache-activemq-5.16.0-bin.tar.gz
        mv apache-activemq-5.16.0 /opt/activemq
        ;;
    2)
        # 安装RabbitMQ
        echo "正在安装RabbitMQ..."
        yum install -y epel-release
        yum install -y erlang
        yum install -y https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.9/rabbitmq-server-3.7.9-1.el7.noarch.rpm
        systemctl start rabbitmq-server
        systemctl enable rabbitmq-server
        ;;
    3)
        # 安装RocketMQ
        echo "正在安装RocketMQ..."
        wget https://archive.apache.org/dist/rocketmq/4.5.0/rocketmq-all-4.5.0-bin-release.zip
        unzip rocketmq-all-4.5.0-bin-release.zip
        mv rocketmq-all-4.5.0-bin-release /opt/rocketmq
        ;;
    *)
        echo "选择无效!"
        exit 1
        ;;
esac

echo "安装完成!"
wuchenchina commented 1 year ago

抱歉,由于我的疏忽,导致代码中出现了过时的东西,已经重新修改代码:

#!/bin/bash

# 检测是否存在JDK8
if [ ! -d "/usr/local/btjdk/jdk8" ]; then
    echo "未找到JDK8,正在安装..."
    yum install -y java-1.8.0-openjdk
else
    echo "在 /usr/local/btjdk/jdk8 找到了JDK8"
fi

# 询问用户选择要安装的MQ
echo "请选择您想安装的MQ:"
echo "1. ActiveMQ"
echo "2. RabbitMQ"
echo "3. RocketMQ"
read -p "请选择 (1/2/3): " choice

case $choice in
    1)
        # 安装ActiveMQ
        echo "正在安装ActiveMQ..."
        wget https://dlcdn.apache.org//activemq/5.18.2/apache-activemq-5.18.2-bin.tar.gz
        tar xzf apache-activemq-5.18.2-bin.tar.gz
        mv apache-activemq-5.18.2 /opt/activemq
        ;;
    2)
        # 安装RabbitMQ
        echo "正在安装RabbitMQ..."
        yum install -y epel-release
        yum install -y erlang
        yum install -y https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.12.6/rabbitmq-server-3.12.6-1.el8.noarch.rpm
        systemctl start rabbitmq-server
        systemctl enable rabbitmq-server
        ;;
    3)
        # 安装RocketMQ
        echo "正在安装RocketMQ..."
        wget https://dist.apache.org/repos/dist/release/rocketmq/5.1.3/rocketmq-all-5.1.3-bin-release.zip
        unzip rocketmq-all-5.1.3-bin-release.zip
        mv rocketmq-all-5.1.3-bin-release /opt/rocketmq
        ;;
    *)
        echo "选择无效!"
        exit 1
        ;;
esac

echo "安装完成!"

该博客位置:链接地址

wuchenchina commented 1 year ago
#!/bin/bash

# 检测并安装函数
install_if_not_exists() {
    local command=$1
    local package=$2

    if ! command -v $command &> /dev/null; then
        echo "未找到$command,正在安装..."
        yum install -y $package
    fi
}

# 创建文件夹如果不存在
ensure_directory_exists() {
    local dir_path=$1

    if [ ! -d "$dir_path" ]; then
        echo "目录 $dir_path 不存在,正在创建..."
        mkdir -p "$dir_path"
    fi
}

# 检测是否存在JDK8
if [ ! -d "/usr/local/btjdk/jdk8" ]; then
    echo "未找到JDK8,正在安装..."
    install_if_not_exists "java" "java-1.8.0-openjdk"
else
    echo "在 /usr/local/btjdk/jdk8 找到了JDK8"
fi

# 依赖检查
install_if_not_exists "wget" "wget"
install_if_not_exists "unzip" "unzip"
install_if_not_exists "tar" "tar"

# 询问用户选择要安装的MQ
echo "请选择您想安装的MQ:"
echo "1. ActiveMQ"
echo "2. RabbitMQ"
echo "3. RocketMQ"
read -p "请输入数字 (1/2/3): " choice

case $choice in
    1)
        # 安装ActiveMQ
        echo "正在安装ActiveMQ..."
        ensure_directory_exists "/opt/activemq"
        wget https://dlcdn.apache.org//activemq/5.18.2/apache-activemq-5.18.2-bin.tar.gz
        tar xzf apache-activemq-5.18.2-bin.tar.gz
        mv apache-activemq-5.18.2 /opt/activemq
        ;;
    2)
        # 安装RabbitMQ
        echo "正在安装RabbitMQ..."
        install_if_not_exists "yum" "yum-utils"
        yum install -y epel-release
        yum install -y erlang
        wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.12.6/rabbitmq-server-3.12.6-1.el8.noarch.rpm
        yum install -y rabbitmq-server-3.12.6-1.el8.noarch.rpm
        systemctl start rabbitmq-server
        systemctl enable rabbitmq-server
        ;;
    3)
        # 安装RocketMQ
        echo "正在安装RocketMQ..."
        ensure_directory_exists "/opt/rocketmq"
        wget https://dist.apache.org/repos/dist/release/rocketmq/5.1.3/rocketmq-all-5.1.3-bin-release.zip
        unzip rocketmq-all-5.1.3-bin-release.zip
        mv rocketmq-all-5.1.3-bin-release /opt/rocketmq
        ;;
    *)
        echo "选择无效!"
        exit 1
        ;;
esac

echo "安装完成!"
wuchenchina commented 1 year ago

对不起我只是个高中生,所以写代码的时候考虑的一直不周全,如有打扰请直接关闭该贴