一、软件基础安装
$ cat > /etc/yum.repos.d/rabbitmq-erlang.repo << EOF
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq-erlang/rpm/erlang/22/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1
EOF
$ yum makecache
$ yum install -y *epel* gcc-c++ unixODBC unixODBC-devel openssl-devel ncurses-devel
链接:https://pan.baidu.com/s/19KIW45ZMoCPYCzyV-mTf2Q
提取码:z3jk
$ rpm -ivh rabbitmq-server-3.7.10-1.el6.noarch.rpm
添加主机名解析到127.0.0.1,不然启动失败,日志会有报错
HOSTNAME=`hostname`
sed -i "/127.0.0.1/ s/$/ $HOSTNAME/" /etc/hosts
cat /var/log/rabbitmq/startup_log
ERROR: epmd error for host db3: timeout (timed out)
启动
$ service rabbitmq-server start
$ chkconfig rabbitmq-server on
# 把managent功能启用
$ rabbitmq-plugins enable rabbitmq_management
如果报以下错误:
ERROR: epmd error for host "77":badarg (unknown POSIX error)
解决办法:
# vi /etc/rabbitmq/rabbitmq-env.conf
在文件里面添加这一行:NODENAME=rabbit@localhost,保存
(注意:rabbitmq-env.conf这个文件没有,打开之后自动创建)
# service rabbitmq-server start
创建管理员账号
# 然后创建账号admin 密码
$ rabbitmqctl add_user admin admin2021
# 设置为管理员账号
$ rabbitmqctl set_user_tags admin administrator
1.创建账号、vhost、授权、和授权控制台登录
$ rabbitmqctl add_user test test2020
$ rabbitmqctl add_vhost test
$ rabbitmqctl set_permissions -p "test" test".*" ".*" ".*"
$ rabbitmqctl set_user_tags test monitoring