CentOS7 install RabbitMQ test
Use
yum install erlang
the command to install erlang, and then download RabbitMQrabbitmq-server-3.7.4-1.el7.noarch.rpm
When executing therpm -ivh rabbitmq-server-3.7.4-1.el7.noarch.rpm
command, an error is reported
warning: rabbitmq-server-3.7.4-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY
error: Failed dependencies:
erlang >= 19.3 is needed by rabbitmq-server-3.7.4-1.el7.noarch
socat is needed by rabbitmq-server-3.7.4-1.el7.noarch
There are two problems here: Problem 1,
erlang >= 19.3 is needed by rabbitmq-server-3.7.4-1.el7.noarch
Problem 2, andsocat is needed by rabbitmq-server-3.7.4-1.el7.noarch
then around these two problems.
Prepare
RabbitMQ: rpm -ivh rabbitmq-server-3.7.4-1.el7.noarch.rpm Download please click here ; erlang: Download please click here
Question two,socat is needed by rabbitmq-server-3.7.4-1.el7.noarch
Solution: use the command
yum -y install socat
to install, I see that some bloggers will encounter another problem at this step会报错没有socat包或是找不到socat包,解决方法安装centos的epel的扩展源
, the solution to this problem:yum -y install epel-release
execute this command and then execute the previous socat installation command
Question one,erlang >= 19.3 is needed by rabbitmq-server-3.7.4-1.el7.noarch
Since we
yum install erlang
installed erlang using the command, its version is not supported,rabbitmq-server-3.7.4-1.el7.noarch
so we reinstall the 19.3 version given by the prompt.
Preparing to install Erlang
First we need to prepare the installation environment
Installation of dependent environment - if you need to compile and install the erlang language environment, you need to install C++ to compile.
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson
I re-install these things with the yum command and then compile, and then compile without error. Execute the install command again.
Get Erlang (the 19.3 version is indicated above, but I can't install it, so I try to download a version that is not the latest)
[root@izbp1e0h5tks006vnlaro4z tool]# wget http://erlang.org/download/otp_src_20.2.tar.gz
--2018-04-26 13:45:42-- http://erlang.org/download/otp_src_20.2.tar.gz
Resolving erlang.org (erlang.org)... 192.121.151.106
Connecting to erlang.org (erlang.org)|192.121.151.106|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 87136848 (83M) [application/x-tar]
Saving to: ‘otp_src_20.2.tar.gz’
100%[=====================================================================================================================================================>] 87,136,848 306KB/s in 4m 40s
2018-04-26 13:50:25 (304 KB/s) - ‘otp_src_20.2.tar.gz’ saved [87136848/87136848]
Unzip the erlang installation package, there will be a lot of things
# tar -xzvf otp_src_20.2.tar.gz
Then we enter the unzipped directory
# cd otp_src_20.2
Compile and install erlang language environment prefix=/usr/local/erlang is the installation directory
./configure --prefix=/usr/local/erlang --enable-smp-support --enable-threads --enable-sctp --enable-kernel-poll --enable-hipe --with-ssl --without-javac
If the installation environment is not ready, an error will be reported when compiling here
configure: error: No curses library functions found
configure: error: /bin/sh '/usr/local/tool/otp_src_19.3/erts/configure' failed for erts
Start installing and compiling:
make && make install
Configure erlang environment variables:
vim /etc/profile
export PATH=$PATH:/usr/local/erlang/bin
//执行下面命令修改配置文件立即生效
source /etc/profil
Verify that the installation was successful:
//注释:输入erl Erlang/OTP 17 [erts-6.2] [source] [smp:2:2] [async-threads:10] [kernel-poll:false],会输出版本号信息
# erl Erlang/OTP 17 [erts-6.2] [source] [smp:2:2] [async-threads:10] [kernel-poll:false]
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.4 (abort with ^G)
1>
Start installing the rabbitmq rpm package
You need to go back to the rabbitmq installation package directory
Execute the rpm install command
# rpm -ivh rabbitmq-server-3.7.4-1.el7.noarch.rpm
Installed the things prepared earlier but still reported an error
[root@ tool]# rpm -ivh rabbitmq-server-3.7.4-1.el7.noarch.rpm
warning: rabbitmq-server-3.7.4-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY
error: Failed dependencies:
erlang >= 19.3 is needed by rabbitmq-server-3.7.4-1.el7.noarch
This method will prompt that the version needs to be greater than R13, and adding -nodeps is ok
[root@izbp1e0h5tks006vnlaro4z tool]# rpm -ivh --nodeps --force rabbitmq-server-3.7.4-1.el7.noarch.rpm
warning: rabbitmq-server-3.7.4-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY
Preparing... ################################# [100%]
Stopping rabbitmq-server (via systemctl): [ OK ]
Updating / installing...
1:rabbitmq-server-3.7.4-1.el7 ################################# [100%]
/etc/profile: line 78: /etc/profil: No such file or directory
warning: %post(rabbitmq-server-3.7.4-1.el7.noarch) scriptlet failed, exit status 1
The above error is because the configuration file I modified does not take effect immediately, PS:
/etc/profile
It needs to be added in the configuration fileexport PATH=$PATH:/usr/rabbitmq/sbin
, save it and make the file take effect: source /erc/profile; reinstall it again
[root@izbp1e0h5tks006vnlaro4z tool]# rpm -ivh --nodeps --force rabbitmq-server-3.7.4-1.el7.noarch.rpm
warning: rabbitmq-server-3.7.4-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY
Preparing... ################################# [100%]
Stopping rabbitmq-server (via systemctl): [ OK ]
Updating / installing...
1:rabbitmq-server-3.7.4-1.el7 ################################# [100%]
Check if the installation was successful
[root@izbp1e0h5tks006vnlaro4z tool]# rabbitmqctl -q status
=ERROR REPORT==== 26-Apr-2018::14:30:34 ===
Loading of /usr/lib/rabbitmq/lib/rabbitmq_server-3.7.4/escript/rabbitmqctl/elixir.beam failed: badfile
Failed to start Elixir.
error: {error,
{elixir,
{bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{undef,
[{elixir,start,[normal,[]],[]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,269}]}]}}}}}}
Open the service:
[root@izbp1e0h5tks006vnlaro4z tool]# service rabbitmq-server start
Starting rabbitmq-server (via systemctl): Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
[FAILED]
[root@izbp1e0h5tks006vnlaro4z tool]# systemctl status rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2018-04-26 15:09:49 CST; 6s ago
Process: 27394 ExecStop=/usr/sbin/rabbitmqctl shutdown (code=exited, status=1/FAILURE)
Process: 27208 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 27208 (code=exited, status=1/FAILURE)
Apr 26 15:09:49 izbp1e0h5tks006vnlaro4z systemd[1]: rabbitmq-server.service: control process exited, code=exited status=1
Apr 26 15:09:49 izbp1e0h5tks006vnlaro4z systemd[1]: Failed to start RabbitMQ broker.
Apr 26 15:09:49 izbp1e0h5tks006vnlaro4z systemd[1]: Unit rabbitmq-server.service entered failed state.
Apr 26 15:09:49 izbp1e0h5tks006vnlaro4z systemd[1]: rabbitmq-server.service failed.