概述
环境
麒麟 V10 ARM 系统 Linux
编译安装
- 下载
- 下载rabbitmq-server-generic-unix-3.10.7.tar.xz
- 或者查看github
- 选择版本Erlang(https://rabbitmq.com/which-erlang.html)
- 下载Erlang源码 25.0.4
- 下载wxwidgets
将下载的包放到
/opt/rabbitmq-server
中
- a1) 安装wxwidgets
编译安装Erlang的前提,需要编译安装wxwidgets
# [下载wxwidgets](http://www.wxwidgets.org/downloads/)
# 解压
bzip2 -dkv wxWidgets-3.2.0.tar.bz2
tar -xvf wxWidgets-3.2.0.tar
# unzip wxWidgets-3.2.0.zip # 或者
#yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel
# Erlang: No OpenGL headers found, wx will NOT be usable
yum install mesa* --skip-broken
yum install freeglut*
# 需要安装GTK+: yum install *gtk*或 yum install *gtk* --skip-broken
yum install *gtk*
# 配置
cd /opt/rabbitmq-server/wxWidgets-3.2.0
./configure --with-opengl --enable-debug --enable-unicode
# 编译&安装(时间有点长)
make && make install
# install path: /usr/local/include/wx-3.2
# 测试
wx-config
- a2) 安装Erlang
# 解压
tar -zxvf otp_src_25.0.4.tar.gz
cd /opt/rabbitmq-server/otp_src_25.0.4
# 配置
./configure --prefix=/usr/local/erlang
# 编译&安装
make && make install
# install path: /usr/local/erlang/bin
- a3) 安装 rabbitmq-server
安装位置:/usr/local/rabbitmq
日志位置:/usr/local/rabbitmq/var/log
yum install libtool libtool-ltdl-devel libevent-devel lua
ncurses-devel openssl-devel flex
xz -d rabbitmq-server-generic-unix-3.10.7.tar.xz
tar xf rabbitmq-server-generic-unix-3.10.7.tar
mv rabbitmq_server-3.10.7 /usr/local/rabbitmq
# 配置环境变量
vim /etc/profile
PATH=$PATH:/usr/local/rabbitmq/sbin
source /etc/profile
PROBLEM:rabbitmq no such file or directory “crypto.app”
下载 https://github.com/openssl/openssl/tags
选择 OpenSSL_1_1_1q
将下载的 openssl-OpenSSL_1_1_1j.tar.gz
tar -xzvf openssl-OpenSSL_1_1_1j.tar.gz
cd /opt/rabbitmq-server/openssl-OpenSSL_1_1_1j
# 配置
./config shared
# 编译安装
make && make install
# ----------------------- Erlang Rebuild -----------------------
cd /opt/rabbitmq-server/otp_src_25.0.4
make clean
# 配置
./configure --prefix=/usr/local/erlang
# 编译安装
make && make install
# 测试
elr
> crypto:start()
PROBLEM:warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running “locale” in your shell)
vim /etc/profile
# 末尾添加
export LC_ALL=en_US.UTF-8
source /etc/profile
PROBLEM:Error: unable to perform an operation on node ‘rabbit@HOST-NAME’. Please see diagnostics information and suggestions below.
vim /etc/hosts
# IP 本机名称
xxx.xxx.xxx.xxx HOST-NAME
- 启动RabbitMQ服务
# 前台启动
rabbitmq-server
# 后台启动
rabbitmq-server -detached
# 查看服务状态
rabbitmqctl status
- 关闭RabbitMQ服务
rabbitmqctl stop
- 启动管理端(添加用户)插件
# 开启web管理界面
rabbitmq-plugins enable rabbitmq_management
# 检查所有插件的启用和禁用状态
# rabbitmq-plugins list
rabbitmqctl add_user admin '123456'
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin '.*' '.*' '.*'
# 重启
rabbitmqctl stop
rabbitmq-server
- 开放服务器端口
firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --zone=public --add-port=5672/tcp --permanent
firewall-cmd --reload
- 测试
curl http://127.0.0.1:15672
curl http://IP:15672
- 设置开机启动
- 将
/usr/local/rabbitmq/sbin/rabbitmq-server
、/usr/local/rabbitmq/sbin/rabbitmq-env
备份 - 将
rabbitmq-server、rabbitmq-env
拷贝到对应的服务器上- 或者修改原先脚本,在脚本头加入
ERLANG_HOME=/usr/local/erlang/bin
;将erl
修改成$ERLANG_HOME/erl
- 或者修改原先脚本,在脚本头加入
- 进入目录
cd /usr/lib/systemd/system
- 将文件拷贝到对应的服务器上
- 重新加载服务
systemctl daemon-reload
- 设置为开机启动
systemctl enable rabbitmq.service
- 查看是否已开机启动
systemctl is-enabled rabbitmq.service
- 查看服务状态
systemctl status rabbitmq.service
- 启用服务
systemctl enable rabbitmq.service
- 启动服务
systemctl start rabbitmq.service
- 停止服务
systemctl stop rabbitmq.service
附录
参考
- install-generic-unix
- rabbitmq config
- RabbitMQ超详细安装教程(Linux)
- 参考
- 填坑参考
- 填坑参考
- 填坑 unable to perform an operation
- 填坑 the VM is running with native name encoding of latin1 which may
- 依赖 openssl
问题
have incorrect checknum [选]
yum clean all
# 或者 vim /etc/yum.repos.d/kylin_aarch64.repo
# 或者 vim /etc/yum.repos.d/local.repo
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release #根据实际修改
配置文件
rabbitmq.service
#
# /usr/lib/systemd/system
# systemd service file for RabbitMQ Server forking server
#
[Unit]
Description=Rabbitmq Server
Documentation=Rabbitmq Server 3.10.7 Rabbitmq Server Generic Unix 3.10.7
Documentation=https://github.com/rabbitmq/rabbitmq-server
Documentation=https://github.com/rabbitmq/rabbitmq-server/releases
Documentation=https://rabbitmq.com/install-generic-unix.html
Documentation=https://rabbitmq.com/which-erlang.html
After=network.target
[Service]
Type=forking
User=root
# Group=root
WorkingDirectory=/usr/local/rabbitmq
ExecStart=/usr/local/rabbitmq/sbin/rabbitmq-server -detached
ExecReload=/usr/local/rabbitmq/sbin/rabbitmqctl stop
ExecStop=/usr/local/rabbitmq/sbin/rabbitmqctl stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
rabbitmq-env
#!/bin/sh -e
##
This Source Code Form is subject to the terms of the Mozilla Public
##
License, v. 2.0. If a copy of the MPL was not distributed with this
##
file, You can obtain one at https://mozilla.org/MPL/2.0/.
##
##
Copyright (c) 2007-2020 VMware, Inc. or its affiliates.
All rights reserved.
##
## /usr/local/rabbitmq/sbin
##
ERLANG_HOME=/usr/local/erlang/bin
if [ "$RABBITMQ_ENV_LOADED" = 1 ]; then
return 0;
fi
if [ -z "$RABBITMQ_SCRIPTS_DIR" ]; then
# We set +e here since since our test for "readlink -f" below needs to
# be able to fail.
set +e
# Determine where this script is really located (if this script is
# invoked from another script, this is the location of the caller)
SCRIPT_PATH="$0"
while [ -h "$SCRIPT_PATH" ] ; do
# Determine if readlink -f is supported at all. TODO clean this up.
FULL_PATH=`readlink -f $SCRIPT_PATH 2>/dev/null`
if [ "$?" != "0" ]; then
REL_PATH=`readlink $SCRIPT_PATH`
if expr "$REL_PATH" : '/.*' > /dev/null; then
SCRIPT_PATH="$REL_PATH"
else
SCRIPT_PATH="`dirname "$SCRIPT_PATH"`/$REL_PATH"
fi
else
SCRIPT_PATH=$FULL_PATH
fi
done
set -e
RABBITMQ_SCRIPTS_DIR=`dirname $SCRIPT_PATH`
fi
_rmq_env_now()
{
date '+%Y-%m-%d %H:%M:%S'
}
_rmq_env_print()
{
_rmq_env_tmp="$1"
_rmq_env_tmp_len="${#_rmq_env_tmp}"
shift
printf '%s %s %sn' "$(_rmq_env_now)" "$_rmq_env_tmp" "$1" 1>&2
shift
_rmq_env_print_line=''
_rmq_env_indent="$((_rmq_env_tmp_len + 21))"
for _rmq_env_print_line in "$@"
do
printf "%${_rmq_env_indent}s%sn" ' ' "$_rmq_env_print_line" 1>&2
done
unset _rmq_env_print_line
unset _rmq_env_indent
unset _rmq_env_tmp_len
unset _rmq_env_tmp
}
_rmq_env_perr()
{
_rmq_env_print '[error]' "$@"
}
_rmq_env_pwarn()
{
_rmq_env_print '[warning]' "$@"
}
rmq_realpath() {
local path=$1
if [ -d "$path" ]; then
cd "$path" && pwd
elif [ -f "$path" ]; then
cd "$(dirname "$path")" && echo $(pwd)/$(basename "$path")
else
echo "$path"
fi
}
RABBITMQ_HOME="$(rmq_realpath "${RABBITMQ_SCRIPTS_DIR}/..")"
ESCRIPT_DIR="${RABBITMQ_HOME}/escript"
## Set defaults
. ${RABBITMQ_SCRIPTS_DIR}/rabbitmq-defaults
# We save the current value of $RABBITMQ_PID_FILE in case it was set by
# an init script. If $CONF_ENV_FILE overrides it again, we must ignore
# it and warn the user.
saved_RABBITMQ_PID_FILE="$RABBITMQ_PID_FILE"
## Get configuration variables from the configure environment file
[ "x" = "x$RABBITMQ_CONF_ENV_FILE" ] && RABBITMQ_CONF_ENV_FILE=${CONF_ENV_FILE}
if [ -f "${RABBITMQ_CONF_ENV_FILE}" ]; then
CONF_ENV_FILE_PHASE=rabbitmq-env
. ${RABBITMQ_CONF_ENV_FILE} || true
fi
[ -n "$ERL_EPMD_PORT" ] && export ERL_EPMD_PORT
[ -n "$ERL_EPMD_ADDRESS" ] && export ERL_EPMD_ADDRESS
DEFAULT_SCHEDULER_BIND_TYPE="db"
[ -n "$SCHEDULER_BIND_TYPE" ] || SCHEDULER_BIND_TYPE="$DEFAULT_SCHEDULER_BIND_TYPE"
[ -n "$RABBITMQ_SCHEDULER_BIND_TYPE" ] || RABBITMQ_SCHEDULER_BIND_TYPE="$SCHEDULER_BIND_TYPE"
DEFAULT_DISTRIBUTION_BUFFER_SIZE=128000
[ -n "$DISTRIBUTION_BUFFER_SIZE" ] || DISTRIBUTION_BUFFER_SIZE="$DEFAULT_DISTRIBUTION_BUFFER_SIZE"
[ -n "$RABBITMQ_DISTRIBUTION_BUFFER_SIZE" ] || RABBITMQ_DISTRIBUTION_BUFFER_SIZE="$DISTRIBUTION_BUFFER_SIZE"
DEFAULT_MAX_NUMBER_OF_PROCESSES=1048576
[ -n "$MAX_NUMBER_OF_PROCESSES" ] || MAX_NUMBER_OF_PROCESSES="$DEFAULT_MAX_NUMBER_OF_PROCESSES"
[ -n "$RABBITMQ_MAX_NUMBER_OF_PROCESSES" ] || RABBITMQ_MAX_NUMBER_OF_PROCESSES="$MAX_NUMBER_OF_PROCESSES"
DEFAULT_MAX_NUMBER_OF_ATOMS=5000000
[ -n "$MAX_NUMBER_OF_ATOMS" ] || MAX_NUMBER_OF_ATOMS="$DEFAULT_MAX_NUMBER_OF_ATOMS"
[ -n "$RABBITMQ_MAX_NUMBER_OF_ATOMS" ] || RABBITMQ_MAX_NUMBER_OF_ATOMS="$MAX_NUMBER_OF_ATOMS"
DEFAULT_SCHEDULER_BUSY_WAIT_THRESHOLD=none
[ -n "$SCHEDULER_BUSY_WAIT_THRESHOLD" ] || SCHEDULER_BUSY_WAIT_THRESHOLD="$DEFAULT_SCHEDULER_BUSY_WAIT_THRESHOLD"
[ -n "$RABBITMQ_SCHEDULER_BUSY_WAIT_THRESHOLD" ] || RABBITMQ_SCHEDULER_BUSY_WAIT_THRESHOLD="$SCHEDULER_BUSY_WAIT_THRESHOLD"
## Common server defaults
SERVER_ERL_ARGS=" +P $RABBITMQ_MAX_NUMBER_OF_PROCESSES +t $RABBITMQ_MAX_NUMBER_OF_ATOMS +stbt $RABBITMQ_SCHEDULER_BIND_TYPE +zdbbl $RABBITMQ_DISTRIBUTION_BUFFER_SIZE +sbwt $RABBITMQ_SCHEDULER_BUSY_WAIT_THRESHOLD +sbwtdcpu $RABBITMQ_SCHEDULER_BUSY_WAIT_THRESHOLD +sbwtdio $RABBITMQ_SCHEDULER_BUSY_WAIT_THRESHOLD "
##--- Set environment vars RABBITMQ_<var_name> to defaults if not set
[ "x" = "x$RABBITMQ_CTL_ERL_ARGS" ] && RABBITMQ_CTL_ERL_ARGS="$CTL_ERL_ARGS"
[ "x" = "x$RABBITMQ_CTL_DIST_PORT_MIN" ] && RABBITMQ_CTL_DIST_PORT_MIN="$CTL_DIST_PORT_MIN"
[ "x" = "x$RABBITMQ_CTL_DIST_PORT_MAX" ] && RABBITMQ_CTL_DIST_PORT_MAX="$CTL_DIST_PORT_MAX"
[ "x" = "x$RABBITMQ_CTL_DIST_PORT_MIN" ] && RABBITMQ_CTL_DIST_PORT_MIN='35672'
[ "x" = "x$RABBITMQ_CTL_DIST_PORT_MAX" ] && RABBITMQ_CTL_DIST_PORT_MAX="$(($RABBITMQ_CTL_DIST_PORT_MIN + 10))"
[ "x" = "x$RABBITMQ_SERVER_ERL_ARGS" ] && RABBITMQ_SERVER_ERL_ARGS=${SERVER_ERL_ARGS}
[ "x" = "x$RABBITMQ_SERVER_START_ARGS" ] && RABBITMQ_SERVER_START_ARGS=${SERVER_START_ARGS}
[ "x" = "x$RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS" ] && RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=${SERVER_ADDITIONAL_ERL_ARGS}
[ "x" = "x$RABBITMQ_SERVER_CODE_PATH" ] && RABBITMQ_SERVER_CODE_PATH=${SERVER_CODE_PATH}
[ "x" = "x$RABBITMQ_IGNORE_SIGINT" ] && RABBITMQ_IGNORE_SIGINT="true"
[ "xtrue" = "x$RABBITMQ_IGNORE_SIGINT" ] && RABBITMQ_IGNORE_SIGINT_FLAG="+B i"
if [ -n "$saved_RABBITMQ_PID_FILE" ] &&
[ "$saved_RABBITMQ_PID_FILE" != "$RABBITMQ_PID_FILE" ]
then
_rmq_env_pwarn 'RABBITMQ_PID_FILE was already set by the init script to:'
"$saved_RABBITMQ_PID_FILE"
'The value set in rabbitmq-env.conf is ignored because it would break the init script.'
RABBITMQ_PID_FILE="$saved_RABBITMQ_PID_FILE"
fi
[ "x" = "x$RABBITMQ_BOOT_MODULE" ] && RABBITMQ_BOOT_MODULE=${BOOT_MODULE}
##--- End of overridden <var_name> variables
_rmq_env_set_erl_libs()
{
if [ -n "$ERL_LIBS" ]
then
export ERL_LIBS="$RABBITMQ_HOME/plugins:$ERL_LIBS"
else
export ERL_LIBS="$RABBITMQ_HOME/plugins"
fi
}
run_escript()
{
escript_main="${1:?escript_main must be defined}"
shift
escript="${1:?escript must be defined}"
shift
_rmq_env_set_erl_libs
# Important: do not quote RABBITMQ_CTL_ERL_ARGS as they must be
# word-split
# shellcheck disable=SC2086
exec $ERLANG_HOME/erl +B
-boot "$CLEAN_BOOT_FILE"
-noinput -noshell -hidden -smp enable
$RABBITMQ_CTL_ERL_ARGS
-kernel inet_dist_listen_min "$RABBITMQ_CTL_DIST_PORT_MIN"
-kernel inet_dist_listen_max "$RABBITMQ_CTL_DIST_PORT_MAX"
-run escript start
-escript main "$escript_main"
-extra "$escript" "$@"
}
RABBITMQ_ENV_LOADED=1
# Since we source this elsewhere, don't accidentally stop execution
true
rabbitmq-server
#!/bin/sh
# vim:sw=4:et:
##
This Source Code Form is subject to the terms of the Mozilla Public
##
License, v. 2.0. If a copy of the MPL was not distributed with this
##
file, You can obtain one at https://mozilla.org/MPL/2.0/.
##
##
Copyright (c) 2007-2020 VMware, Inc. or its affiliates.
All rights reserved.
##
## /usr/local/rabbitmq/sbin
##
set -e
ERLANG_HOME=/usr/local/erlang/bin
# Get default settings with user overrides for (RABBITMQ_)<var_name>
# Non-empty defaults should be set in rabbitmq-env
SCRIPTS_DIR=$(dirname "$0")
. "$SCRIPTS_DIR/rabbitmq-env"
[ "$NOTIFY_SOCKET" ] && RUNNING_UNDER_SYSTEMD=true
RABBITMQ_DEFAULT_ALLOC_ARGS="+MBas ageffcbf +MHas ageffcbf +MBlmbcs 512 +MHlmbcs 512 +MMmcs 30"
# Bump ETS table limit to 50000
if [ "x" = "x$ERL_MAX_ETS_TABLES" ]; then
ERL_MAX_ETS_TABLES=50000
fi
check_start_params() {
check_not_empty RABBITMQ_BOOT_MODULE
check_not_empty SASL_BOOT_FILE
}
check_not_empty() {
local name="${1:?}"
local value
eval value=$$name
if [ -z "$value" ]; then
echo "Error: ENV variable should be defined: $1.
Please check rabbitmq-env, rabbitmq-defaults, and ${RABBITMQ_CONF_ENV_FILE} script files"
exit 78
fi
}
start_rabbitmq_server() {
set -e
_rmq_env_set_erl_libs
RABBITMQ_START_RABBIT=
[ "x" = "x$RABBITMQ_ALLOW_INPUT" ] && RABBITMQ_START_RABBIT=" -noinput"
if test -z "$RABBITMQ_NODE_ONLY"; then
if test "$USE_RABBIT_BOOT_SCRIPT"; then
# TODO: This is experimental and undocumented at this point.
# It is here just to do simple checks while playing with how
# RabbitMQ is started.
"$SCRIPTS_DIR/rabbitmq-rel" gen-boot
SASL_BOOT_FILE=rabbit
test -f "$SASL_BOOT_FILE.boot"
RABBITMQ_START_RABBIT="$RABBITMQ_START_RABBIT -init_debug"
else
RABBITMQ_START_RABBIT="$RABBITMQ_START_RABBIT -s $RABBITMQ_BOOT_MODULE boot"
fi
fi
# We need to turn off path expansion because some of the vars,
# notably RABBITMQ_SERVER_ERL_ARGS, contain terms that look like
# globs and there is no other way of preventing their expansion.
set -f
export ERL_MAX_ETS_TABLES
SYS_PREFIX
check_start_params
exec $ERLANG_HOME/erl
-pa "$RABBITMQ_SERVER_CODE_PATH"
${RABBITMQ_START_RABBIT}
-boot "${SASL_BOOT_FILE}"
+W w
${RABBITMQ_DEFAULT_ALLOC_ARGS}
${RABBITMQ_SERVER_ERL_ARGS}
${RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS}
${RABBITMQ_SERVER_START_ARGS}
-syslog logger '[]'
-syslog syslog_error_logger false
-kernel prevent_overlapping_partitions false
"$@"
}
stop_rabbitmq_server() {
if test "$rabbitmq_server_pid"; then
kill -TERM "$rabbitmq_server_pid"
wait "$rabbitmq_server_pid" || true
fi
}
if [ "$RABBITMQ_ALLOW_INPUT" -o "$RUNNING_UNDER_SYSTEMD" -o "$detached" ]; then
# Run erlang VM directly, completely replacing current shell
# process - so the pid file written in the code above will be
# valid (unless detached, which is also handled in the code
# above).
#
# And also this is the correct mode to run the broker under
# systemd - there is no need in a proxy process that converts
# signals to graceful shutdown command, the unit file should already
# contain instructions for graceful shutdown. Also by removing
# this additional process we could simply use value returned by
# `os:getpid/0` for a systemd ready notification.
start_rabbitmq_server "$@"
else
# When RabbitMQ runs in the foreground but the Erlang shell is
# disabled, we setup signal handlers to stop RabbitMQ properly. This
# is at least useful in the case of Docker.
# The Erlang VM should ignore SIGINT.
RABBITMQ_SERVER_START_ARGS="${RABBITMQ_SERVER_START_ARGS} ${RABBITMQ_IGNORE_SIGINT_FLAG}"
# Signal handlers. They all stop RabbitMQ properly, using
# rabbitmqctl stop. This script will exit with different exit codes:
#
SIGHUP, SIGTSTP + SIGCONT
#
Ignored until we implement a useful behavior.
#
SIGTERM
#
Exits 0 since this is considered a normal process termination.
#
SIGINT
#
Exits 128 + $signal_number where $signal_number is 2 for SIGINT (see
#
https://pubs.opengroup.org/onlinepubs/009695399/utilities/kill.html).
#
This is considered an abnormal process termination. Normally, we
#
don't need to specify this exit code because the shell propagates it.
#
Unfortunately, the signal handler doesn't work as expected in Dash,
#
thus we need to explicitly restate the exit code.
#
# The behaviors below should remain consistent with the
# equivalent signal handlers in the Erlang code
# (see apps/rabbitmq_prelaunch/src/rabbit_prelaunch_sighandler.erl).
trap '' HUP TSTP CONT
trap "stop_rabbitmq_server; exit 0" TERM
trap "stop_rabbitmq_server; exit 130" INT
start_rabbitmq_server "$@" &
export rabbitmq_server_pid=$!
# Block until RabbitMQ exits or a signal is caught.
# Waits for last command (which is start_rabbitmq_server)
#
# The "|| true" is here to work around an issue with Dash. Normally
# in a Bourne shell, if `wait` is interrupted by a signal, the
# signal handlers defined above are executed and the script
# terminates with the exit code of `wait` (unless the signal handler
# overrides that).
# In the case of Dash, it looks like `set -e` (set at the beginning
# of this script) gets precedence over signal handling. Therefore,
# when `wait` is interrupted, its exit code is non-zero and because
# of `set -e`, the script terminates immediately without running the
# signal handler. To work around this issue, we use "|| true" to
# force that statement to succeed and the signal handler to properly
# execute. Because the statement below has an exit code of 0, the
# signal handler has to restate the expected exit code.
wait "$rabbitmq_server_pid" || true
fi
最后
以上就是怡然夕阳为你收集整理的【Linux-ARM】安装 RabbitMQ环境编译安装附录的全部内容,希望文章能够帮你解决【Linux-ARM】安装 RabbitMQ环境编译安装附录所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复