title: 安装配置.md
toc: true
date: 2021-12-22 09:25:00
采用编译完好的二进制文件
登录RocketMQ官网,选择download a binary release here,从指定位置下载编译好的二进制Rocketmq
安装Maven
sudo apt-get install maven
更换国内源
cp /usr/share/maven/conf/settings.xml /usr/share/maven/conf/settings.xml.backup
gedit /usr/share/maven/conf/settings.xml
备份后,替换内容如下
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>aliyun</id>
<!-- repositories and pluginRepositories here-->
<repositories>
<repository>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>aliyun</activeProfile>
</activeProfiles>
</settings>
使用解压后的内容替换RocketMQ/bin文件
修改启动脚本StartRocketMQ,sh 中路径,如果未安装可视化客户端需要注释后三行内容。5000表示RocketMQ所使用的端口号,可以根据需要进行修改。
StartRocketMQ.sh
#!/bin/bash
#修改为安装路径
cd /home/lightning/Aplications/RocketMQ
#修改为启动脚本所在路径
nohup sh bin/mqnamesrv -c /home/lightning/桌面/RocketMQ/mqnamesrv.properties > /dev/null
2> /dev/null &
nohup sh bin/mqbroker -n localhost:5000 > /dev/null 2> /dev/null &
#export NAMESRV_ADDR=localhost:5000
#cd Tools
#nohup java -jar rocketmq-console-ng-2.0.0.jar --server.port=5002 > /usr/local/bin/RocketMQ/Tools/console.log.txt &
ShutdownRocketMQ.sh
#!/bin/bash
#修改路径为安装目录
cd /home/lightning/Aplications/RocketMQ
bin/mqshutdown broker
bin/mqshutdown namesrv
修改完成后在脚本目录下打开命令行
./StartRocketMQ.sh
sudo netstat -ap | grep 5000
若返回端口为5000当前的服务,说明运行正常