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
How to Install and Run RocketMQ on CentOS 7: A Step‑by‑Step Guide

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
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
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.