Skip to content
How to Install and Run RocketMQ on CentOS 7: A Step‑by‑Step Guide

How to Install and Run RocketMQ on CentOS 7: A Step‑by‑Step Guide

This article records a complete, step‑by‑step installation and startup process for Apache RocketMQ on a CentOS 7 system, covering environment checks, downloading the package, extracting files, launching the name server and broker, adjusting memory settings, and verifying the setup with a test client.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations

1. Download RocketMQ installation package

Visit the Apache website, choose the desired version (e.g., 4.9.7), and copy the filename to the URL.

wget https://archive.apache.org/dist/rocketmq/4.9.7/rocketmq-all-4.9.7-bin-release.zip

Download the zip file to /usr/local/soft_hzz/ and wait for it to finish.

unzip rocketmq-all-4.9.7-bin-release.zip -d /usr/local/soft_hzz/rocketmq/

2. Start Name Server

nohup sh mqnamesrv &

– start in background sh mqnamesrv – start in foreground (logs appear, Ctrl+C to stop)

Execute the background command in the RocketMQ directory:

nohup sh bin/mqnamesrv &

3. Start Broker

nohup sh bin/mqbroker -n 172.30.128.65:9876 &

– start broker in background sh bin/mqbroker -n 172.30.128.65:9876 – start in foreground

If the broker fails due to insufficient memory, edit /bin/runbroker.sh to reduce the JVM heap size (e.g., set both max and min heap to 256 MB) and restart:

nohup sh bin/mqbroker -n 172.30.128.65:9876 &

4. Test the installation

Configure a local project to use the RocketMQ address 172.30.128.65:9876, start the project, and send/consume messages to verify that the broker and name server are working correctly.

If the Name Server also reports memory‑related errors, adjust its heap settings in the same way; all startup scripts are located in the bin directory.
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Message QueueRocketMQinstallationcentos7
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.