012_redhat安装activemq

1.官网下载安装包

ActiveMQ (apache.org)

2.上传并解压ActiveMQ安装包: 将下载的ActiveMQ安装包上传到你的Linux服务器上

[root@rhel soft]# tar -zxvf apache-activemq-5.16.7-bin.tar.gz  -C /usr/local/
# 删除卸载
[root@rhel ~]# rm -rf /usr/local/apache-activemq-5.16.7/

3.启动ActiveMQ服务: 进入解压后的ActiveMQ目录下的bin󠁪子目录,然后运行以下命令来启动ActiveMQ服务:

[root@rhel soft]# cd /usr/local/apache-activemq-5.16.7/bin
[root@rhel bin]# ll
total 144
-rwxr-xr-x 1 root root 26694 Jan 31  2022 activemq
-rwxr-xr-x 1 root root  6190 Jan 31  2022 activemq-diag
-rw-r--r-- 1 root root 15945 Jan 31  2022 activemq.jar
-rw-r--r-- 1 root root  5645 Jan 31  2022 env
drwxr-xr-x 2 root root    78 Jun 16 00:30 linux-x86-32
drwxr-xr-x 2 root root    78 Jun 16 00:30 linux-x86-64
drwxr-xr-x 2 root root    82 Jun 16 00:30 macosx
-rw-r--r-- 1 root root 83820 Jan 31  2022 wrapper.jar


# 启动  这将后台启动ActiveMQ服务
[root@rhel bin]# ./activemq start
INFO: Loading '/usr/local/apache-activemq-5.16.7//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_381/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/apache-activemq-5.16.7//data/activemq.pid' (pid '34998')

# 验证ActiveMQ运行状态: 可以通过以下命令来检查ActiveMQ是否正在运行:
[root@rhel bin]# ./activemq status
INFO: Loading '/usr/local/apache-activemq-5.16.7//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_381/bin/java'
ActiveMQ is running (pid '34998')

# 关闭ActiveMQ服务
[root@rhel bin]# ./activemq stop
INFO: Loading '/usr/local/apache-activemq-5.16.7//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_381/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid '34998' : 
Java Runtime: Oracle Corporation 1.8.0_381 /usr/local/jdk1.8.0_381/jre
  Heap sizes: current=62976k  free=62320k  max=932352k
    JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/usr/local/apache-activemq-5.16.7//conf/login.config -Dactivemq.classpath=/usr/local/apache-activemq-5.16.7//conf:/usr/local/apache-activemq-5.16.7//../lib/: -Dactivemq.home=/usr/local/apache-activemq-5.16.7/ -Dactivemq.base=/usr/local/apache-activemq-5.16.7/ -Dactivemq.conf=/usr/local/apache-activemq-5.16.7//conf -Dactivemq.data=/usr/local/apache-activemq-5.16.7//data
Extensions classpath:
  [/usr/local/apache-activemq-5.16.7/lib,/usr/local/apache-activemq-5.16.7/lib/camel,/usr/local/apache-activemq-5.16.7/lib/optional,/usr/local/apache-activemq-5.16.7/lib/web,/usr/local/apache-activemq-5.16.7/lib/extra]
ACTIVEMQ_HOME: /usr/local/apache-activemq-5.16.7
ACTIVEMQ_BASE: /usr/local/apache-activemq-5.16.7
ACTIVEMQ_CONF: /usr/local/apache-activemq-5.16.7/conf
ACTIVEMQ_DATA: /usr/local/apache-activemq-5.16.7/data
Connecting to pid: 34998
Stopping broker: localhost
.. FINISHED


# 如果你想在前台启动并查看日志输出,可以使用
[root@rhel bin]# ./activemq console
INFO: Loading '/usr/local/apache-activemq-5.16.7//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_381/bin/java'
INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
INFO: Creating pidfile /usr/local/apache-activemq-5.16.7//data/activemq.pid
Java Runtime: Oracle Corporation 1.8.0_381 /usr/local/jdk1.8.0_381/jre
  Heap sizes: current=62976k  free=58040k  max=932352k
    JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/usr/local/apache-activemq-5.16.7//conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/usr/local/apache-activemq-5.16.7//tmp -Dactivemq.classpath=/usr/local/apache-activemq-5.16.7//conf:/usr/local/apache-activemq-5.16.7//../lib/: -Dactivemq.home=/usr/local/apache-activemq-5.16.7/ -Dactivemq.base=/usr/local/apache-activemq-5.16.7/ -Dactivemq.conf=/usr/local/apache-activemq-5.16.7//conf -Dactivemq.data=/usr/local/apache-activemq-5.16.7//data
Extensions classpath:
  [/usr/local/apache-activemq-5.16.7/lib,/usr/local/apache-activemq-5.16.7/lib/camel,/usr/local/apache-activemq-5.16.7/lib/optional,/usr/local/apache-activemq-5.16.7/lib/web,/usr/local/apache-activemq-5.16.7/lib/extra]
ACTIVEMQ_HOME: /usr/local/apache-activemq-5.16.7
ACTIVEMQ_BASE: /usr/local/apache-activemq-5.16.7
ACTIVEMQ_CONF: /usr/local/apache-activemq-5.16.7/conf
ACTIVEMQ_DATA: /usr/local/apache-activemq-5.16.7/data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@50b494a6: startup date [Sun Jun 16 00:49:20 CST 2024]; root of context hierarchy
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[/usr/local/apache-activemq-5.16.7/data/kahadb]
 INFO | KahaDB is version 7
 INFO | PListStore:[/usr/local/apache-activemq-5.16.7/data/localhost/tmp_storage] started
 INFO | Apache ActiveMQ 5.16.7 (localhost, ID:rhel-30233-1718470161742-0:1) is starting
 INFO | Listening for connections at: tcp://rhel:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector openwire started
 INFO | Listening for connections at: amqp://rhel:56721?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector amqp started
 INFO | Listening for connections at: stomp://rhel:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector stomp started
 INFO | Listening for connections at: mqtt://rhel:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector mqtt started
 INFO | Starting Jetty server
 INFO | Creating Jetty connector
 WARN | ServletContext@o.e.j.s.ServletContextHandler@25bfcafd{/,null,STARTING} has uncovered http methods for path: /
 INFO | Listening for connections at ws://rhel:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector ws started
 INFO | Apache ActiveMQ 5.16.7 (localhost, ID:rhel-30233-1718470161742-0:1) started
 INFO | For help or more information please see: http://activemq.apache.org
 WARN | Store limit is 102400 mb (current store usage is 0 mb). The data directory: /usr/local/apache-activemq-5.16.7/data/kahadb only has 44150 mb of usable space. - resetting to maximum available disk space: 44150 mb
 WARN | Temporary Store limit is 51200 mb (current store usage is 0 mb). The data directory: /usr/local/apache-activemq-5.16.7/data only has 44150 mb of usable space. - resetting to maximum available disk space: 44150 mb
 INFO | ActiveMQ WebConsole available at http://127.0.0.1:8161/
 INFO | ActiveMQ Jolokia REST API available at http://127.0.0.1:8161/api/jolokia/


# 命令查找进程
ps aux | grep activemq
# (在Linux系统中)检查端口是否被占用,或者直接检查服务的状态。
netstat -tuln | grep 5672

# 配置防火墙: 如果你的系统防火墙是开启的,你可能需要开放ActiveMQ使用的端口(默认是61616)。这可以通过
firewall-cmd --permanent --add-port=61616/tcp󠁪  命令来实现。


修改ActiveMQ的管理控制台地址
http://127.0.0.1:8161/ --->  http://ip***:8161/   默认账号密码:admin/admin

4.设置开机自启

#1.创建脚本
[root@rhel ~]# vim /etc/init.d/activemq

#2.编辑脚本(注意修改JAVA_HOME和MQ_HOME的值)
#!/bin/bash
# chkconfig: 2345 10 90 
# description: activemq ....
prog=activemq
JAVA_HOME=/usr/local/jdk1.8.0_381
export JAVA_HOME
MQ_HOME=/usr/local/apache-activemq-5.16.7
export MQ_HOME 
case "$1" in
start)
   echo "Starting $prog..."
   $MQ_HOME/bin/activemq start
   ;;
stop)
  echo "Stopping $prog..."
   $MQ_HOME/bin/activemq stop
   ;;
restart)
   echo "Stopping $prog..."
   $MQ_HOME/bin/activemq stop
   sleep 2
   echo
   echo "Starting $prog..."
   $MQ_HOME/bin/activemq start
   ;;
*)
   echo "Usage: $prog {start|stop|restart}"
   ;;
esac
exit

#3.赋予该脚本可执行权限
[root@rhel ~]# chmod +x /etc/init.d/activemq
#4.添加到开机启动
[root@rhel ~]# chkconfig  --add activemq
#软链接
[root@rhel ~]# ln -s /etc/init.d/activemq    /etc/rc3.d/activemq

#5.可以以系统服务的方式启动、查看状态和停止服务
# service activemq start
# service activemq status
# service activemq stop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值