Site icon FSIBLOG

How Fix RabbitMQ Server Installation on CentOS Erlang Error

How Fix RabbitMQ Server Installation on CentOS Erlang Error

How Fix RabbitMQ Server Installation on CentOS Erlang Error

If you’re trying to install RabbitMQ on CentOS 6 using an RPM file and you’re encountering an error, don’t worry it’s a common issue. This usually happens when the version of Erlang installed on your system doesn’t meet the requirements for RabbitMQ or when there are mismatched dependencies.

I will walk you through the error you’re facing, explain why it’s happening, and provide solutions to get RabbitMQ installed and running on your CentOS machine.

Error Code

Here’s the error you encountered while trying to install RabbitMQ:

[root@osboxes CentOS]# rpm -Uvh rabbitmq-server-3.5.3-1.noarch.rpm
warning: rabbitmq-server-3.5.3-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 056e8e56: NOKEY
error: Failed dependencies:
erlang >= R13B-03 is needed by rabbitmq-server-3.5.3-1.noarch

Breakdown of the Error:

Why Is Erlang Not Recognized?

Looking at the output of your terminal, it shows that Erlang is installed:

[root@osboxes CentOS]# which erl
/usr/bin/erl
[root@osboxes CentOS]#
[root@osboxes CentOS]# erl
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.0 (abort with ^G)
1>

However, RabbitMQ isn’t picking up Erlang, even though version 17 is installed. This could be due to misconfigured environment variables or an incorrect installation path for Erlang.

Verify Erlang Version

The first step is to verify that the Erlang version installed on your system is compatible with RabbitMQ 3.5.3. RabbitMQ 3.5.x requires Erlang version 17.0 or higher. You can check your version by running:

erl -version

Since your output shows Erlang version 17, this should meet the minimum version requirement. The problem, however, is likely due to RabbitMQ not detecting Erlang correctly.

Set the ERLANG_HOME Environment Variable

RabbitMQ relies on the ERLANG_HOME environment variable to locate Erlang. If this variable isn’t set correctly, RabbitMQ may not be able to detect the installed version of Erlang, even if it’s present on the system.

Here’s how you can set the ERLANG_HOME variable:

nano ~/.bash_profile
export ERLANG_HOME=/usr/lib64/erlang

Ensure that the path to Erlang (/usr/lib64/erlang) matches the location where Erlang is installed on your system. You can check the location by running:

whereis erlang
source ~/.bash_profile
echo $ERLANG_HOME

It should output the path where Erlang is installed.

    Use the Correct Erlang Version

    If RabbitMQ still can’t detect the installed version of Erlang, you may need to install a different Erlang version that’s compatible with RabbitMQ 3.5.3. Here’s how you can upgrade or install the required Erlang version:

    wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
    dpkg -i erlang-solutions_2.0_all.deb
    yum install erlang

    Re-run the RabbitMQ Installation

    After ensuring that the ERLANG_HOME variable is correctly set and that the right version of Erlang is installed, retry the RabbitMQ installation:

    rpm -Uvh rabbitmq-server-3.5.3-1.noarch.rpm

    Alternative RabbitMQ Installation Methods

    If you’re still facing issues, you can consider using one of these alternative installation methods:

    1. Install RabbitMQ from the Official Repository: Instead of manually installing the RPM file, you can install RabbitMQ from the official RabbitMQ repository. This method simplifies the process, as it handles dependencies for you. Follow the official RabbitMQ installation guide for detailed steps.
    2. Use Docker: If your system supports Docker, you can quickly set up RabbitMQ in a container. This bypasses the need to deal with package dependencies on your system. To run RabbitMQ in a Docker container, you can use the following command:
    docker run -d --name rabbitmq -p 15672:15672 -p 5672:5672 rabbitmq:management

    Additional Practice Functionality

    Once RabbitMQ is up and running, you can practice by adding more functionality:

    rabbitmqctl add_queue my_queue

    To send a message, use:

    rabbitmqctl send_message my_queue "Hello, RabbitMQ!"
    import pika
    
    # Establish connection and channel
    connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
    channel = connection.channel()
    
    # Declare a queue
    channel.queue_declare(queue='hello')
    
    # Send a message
    channel.basic_publish(exchange='', routing_key='hello', body='Hello World!')
    
    print("Sent 'Hello World!'")
    
    # Close the connection
    connection.close()

    Conclusion

    By following these steps, you should be able to resolve the Erlang dependency issue and successfully install RabbitMQ on your CentOS 6 machine. Once you’ve got RabbitMQ running, you can experiment with more advanced features, such as message queuing and integration with various programming languages like Python.

    Exit mobile version