在官网下载然后上传到 Linux 上或者直接使用下面的命令下载对应的版本。
[root@bogon local]# wget http://erlang.org/download/otp_src_19.3.tar.gz
或者 erlang 官网自行下载:http://erlang.org/download/
[root@bogon local]# tar -xvzf otp_src_19.3.tar.gz
[root@bogon local]# rm -rf otp_src_19.3.tar.gz
[root@bogon local]# yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC-devel
[root@bogon local]# mkdir erlang
[root@bogon local]# cd otp_src_19.3
[root@bogon otp_src_19.3]# ./configure --prefix=/usr/local/erlang --without-javac
[root@bogon otp_src_19.3]# make && make install
[root@bogon otp_src_19.3]# ./bin/erl
运行下面的语句输出“hello world”
io:format("hello world~n", []).
[root@bogon /]# cd etc/
[root@bogon etc]# vim profile
追加下列环境变量到文件末尾
#erlang
ERL_HOME=/usr/local/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH
运行下列命令使配置文件profile生效
[root@bogon etc]# source /etc/profile
输入 erl 查看 erlang 环境变量是否配置正确
[root@bogon etc]# erl
[root@bogon /]# cd usr/local/
1. 下载rpm
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.8/rabbitmq-server-3.6.8-1.el7.noarch.rpm
或者直接在官网下载
https://www.rabbitmq.com/install-rpm.html
2. 安装rpm(默认地址一般在 /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.8/)
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
紧接着执行:
yum install rabbitmq-server-3.6.8-1.el7.noarch.rpm
需要尝试执行
[root@bogon local]# rpm -Va --nofiles --nodigest
[root@bogon local]# yum install rabbitmq-server-3.6.8-1.el7.noarch.rpm
如还报错(需要:erlang >= R16B-03) 则解决方法为
[root@bogon local]# yum -y install socat
[root@bogon local]# yum -y install epel-release
[root@bogon local]# yum -y install socat
[root@bogon local]# yum install rabbitmq-server-3.6.8-1.el7.noarch.rpm
3 开启 web 管理插件
rabbitmq-plugins enable rabbitmq_management
4 设置开机启动
chkconfig rabbitmq-server on
systemctl enable rabbitmq-server.service
4. 启动服务
service rabbitmq-server start
如提示:Redirecting to /bin/systemctl start rabbitmq-server.service 则启动命令按照要求换成下述即可
/bin/systemctl start rabbitmq-server.service
5. 查看服务状态
service rabbitmq-server status
/bin/systemctl status rabbitmq-server.service
6. 访问 RabbitMQ 控制台
浏览器访问:http://你的ip地址:15672/
默认用户名和密码: guest/guest;但是需要注意的是:guestuest用户只是被容许从localhost访问。官网文档描述如下:
“guest” user can only connect via localhost
解决远程访问 RabbitMQ 远程访问密码错误
新建用户并授权
[root@bogon rabbitmq]# rabbitmqctl add_user root root
Creating user "root" ...
[root@bogon rabbitmq]# rabbitmqctl set_user_tags root administrator
Setting tags for user "root" to [administrator] ...
[root@bogon rabbitmq]#
[root@bogon rabbitmq]# rabbitmqctl set_permissions -p / root ".*" ".*" ".*"
Setting permissions for user "root" in vhost "/" ...
再次访问:http://你的ip地址:15672/ ,输入用户名和密码:root root
ps -ef | grep rabbitmq
如果启动,查看linux防火墙是否关闭,未关闭时进行关闭
查看当前防火墙状态: systemctl status firewalld
关闭当前防火墙: systemctl stop firewalld
开机防火墙不启动: systemctl disable firewalld
设置完成后访问http://你的ip地址:15672/,输入用户名和密码:root root
参考文献:
https://blog.csdn.net/zxl0428/article/details/104022122,
https://github.com/Snailclimb/JavaGuide/blob/master/docs/system-design/distributed-system/message-queue/RabbitMQ%E5%85%A5%E9%97%A8%E7%9C%8B%E8%BF%99%E4%B8%80%E7%AF%87%E5%B0%B1%E5%A4%9F%E4%BA%86.md