Installing RabbitMQ on nixOS
RabbitMQ is a message broker that allows you to send and receive messages between different services. In this tutorial, we will be installing RabbitMQ on nixOS.
Prerequisites
- A nixOS system installed
- Root access to the machine
- A working internet connection
Installation
- Open a terminal and run the following commands to update your system:
sudo nix-channel --update
sudo nix-env -i rabbitmq-server
- RabbitMQ requires Erlang to run. You can install Erlang by running:
sudo nix-env -i erlang
- Once Erlang is installed, start RabbitMQ using the following command:
sudo rabbitmq-server -detached
This command will start RabbitMQ in the background. You can test that RabbitMQ is running correctly by checking its status:
sudo rabbitmqctl status
If RabbitMQ is running correctly, you should see output similar to this:
Status of node 'rabbit@localhost' ...
[{pid,2510},
{running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.7.16"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.16"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.16"},
{rabbit,"RabbitMQ","3.7.16"},
{rabbit_common,
"Modules shared by rabbitmq-server and rabbitmq-erlang-client",
"3.7.16"},
{cowboy,"Small, fast, modular HTTP server.","2.2.0"},
{ranch,"Socket acceptor pool for TCP protocols.","1.3.2"},
{ssl,"Erlang/OTP SSL application","9.1"},
{public_key,"Public key infrastructure","1.6.2"},
{asn1,"The Erlang ASN1 compiler version 5.0.7","5.0.7"},
{os_mon,"CPO CXC 138 46","2.4.4"},
{rabbitmq_auth_backend_ldap,
"RabbitMQ LDAP authentication backend","3.7.16"},
{rabbitmq_auth_mechanism_ssl,
"RabbitMQ SSL authentication plugin","3.7.16"},
{rabbitmq_server,"RabbitMQ Server","3.7.16"}]},
{os,{unix,linux}},
{erlang_version,
"Erlang/OTP 23 [erts-11.1.8.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:64] [hipe] [dtrace]\n"},
{memory,[{connection_readers,0},
{connection_writers,0},
{connection_channels,0},
{connection_other,0},
{queue_procs,0},
{queue_slave_procs,0},
{plugins,276216},
{other_proc,2834728},
{metrics,0},
{mgmt_db,63680},
{mnesia,93616},
{other_ets,918320},
{binary,77640},
{msg_index,64784},
{code,23274065},
{atom,1045905},
{other_system,6024715}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,4162493747},
{disk_free_limit,50000000},
{disk_free,35294091648},
{file_descriptors,[{total_limit,924},{total_used,10},{sockets_limit,829},{sockets_used,8}]},
{processes,[{limit,1048576},{used,67}]},
{run_queue,0},
{uptime,504}}
- RabbitMQ is now installed and running on your nixOS system! You can access the RabbitMQ web management console by navigating to
http://localhost:15672in your web browser.
Conclusion
In this tutorial, we have installed RabbitMQ on nixOS and started the service. RabbitMQ is a powerful tool that enables reliable messaging between different services. If you encounter any issues during installation or usage, the official RabbitMQ documentation is a great resource for troubleshooting.