首頁 > 軟體

CentOS 7 下安裝 ActiveMQ 5.14.3

2020-06-16 16:57:45

環境

[root@node1 ~]# cat /etc/RedHat-release 
CentOS Linux release 7.1.1503 (Core) 
[root@node1 ~]# uname -r
3.10.0-229.el7.x86_64

關閉防火牆和SElinux

[root@node1 ~]# systemctl stop firewalld
[root@node1 ~]# setenforce 0

安裝包下載

 jdk:連結:http://pan.baidu.com/s/1pLkKMU3 密碼:b3cd
 ActiveMQ:連結:http://pan.baidu.com/s/1mhJM7Pm 密碼:1nyl

 安裝Java 1.8

檢視CentOS自帶JDK是否已安裝

[root@node1 ~]# yum list installed |grep java
java-1.6.0-openjdk.x86_64
java-1.6.0-openjdk-devel.x86_64
java-1.7.0-openjdk.x86_64
java-1.7.0-openjdk-devel.x86_64
tzdata-java.noarch 2015e-1.el6 @anaconda-CentOS-201508042137.x86_64
 

若有自帶安裝的JDK,解除安裝CentOS系統自帶Java環境

[root@node1 ~]# yum -y remove java-1.7.0-openjdk* 
[root@node1 ~]# yum -y remove java-1.6.0-openjdk*

解除安裝 tzdata-java

[root@node1 ~]# yum -y remove tzdata-java.noarch

上傳jdk-8u131-linux-x64.rpm

[root@node1 ~]# rz  軟體包的地址

解壓

 
[root@node1 ~]# rpm -ivh jdk-8u131-linux-x64.rpm

Preparing... ########################################### [100%]
1:jdk1.8.0_131 ########################################### [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
 

進入組態檔

[root@node1 ~]# vim /etc/profile

將以下檔案新增到尾行

JAVA_HOME=/usr/java/jdk1.8.0_131
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH

更新 profile 檔案

[root@node1 ~]# source /etc/profile

檢視Java版本資訊

[root@node1 ~]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

安裝ActiveMQ

下載:apache-activemq-5.14.3-bin.tar.gz

建立activemq目錄

[root@node1 ~]# mkdir -p /usr/local/activemq

進入activemq目錄

[root@node1 ~]# cd /usr/local/activemq/

上傳activemq安裝包

[root@node1 activemq]# rz apache-activemq-5.14.3-bin.tar.gz

解壓

[root@node1 activemq]# tar -zxvf apache-activemq-5.14.3-bin.tar.gz

檢視目錄

[root@node1 activemq]# ll
total 53012
drwxr-xr-x 10 root root     4096 Dec 19  2016 apache-activemq-5.14.3
-rw-r--r--  1 root root 54277759 Oct 18  2017 apache-activemq-5.14.3-bin.tar.gz

檢視bin目錄

[root@node1 activemq]# cd apache-activemq-5.14.3/bin/
[root@node1 bin]# ll
total 140
-rwxr-xr-x 1 root root 21446 Dec 19  2016 activemq
-rwxr-xr-x 1 root root  6189 Dec 19  2016 activemq-diag
-rw-r--r-- 1 root root 15986 Dec 19  2016 activemq.jar
-rw-r--r-- 1 root root  4884 Dec 19  2016 env
drwxr-xr-x 2 root root    74 Sep  1 05:16 linux-x86-32
drwxr-xr-x 2 root root    93 Sep  1 05:16 linux-x86-64
drwxr-xr-x 2 root root    78 Sep  1 05:16 macosx
-rw-r--r-- 1 root root 83820 Dec 19  2016 wrapper.jar

在linux-x86-64  目錄下啟動activemq 並檢視進程

[root@node1 bin]# cd linux-x86-64/
[root@node1 linux-x86-64]# ./activemq start
 
[root@node1 linux-x86-64]# ps -ef | grep activemq 
root       2940      1  0 05:16 ?        00:00:01 /usr/local/activemq/apache-activemq-5.14.3/bin/linux-x86-64/wrapper /usr/local/activemq/apache-activemq-5.14.3/bin/linux-x86-64/wrapper.conf wrapper.syslog.ident=ActiveMQ wrapper.pidfile=/usr/local/activemq/apache-activemq-5.14.3/bin/linux-x86-64/./ActiveMQ.pid wrapper.daemonize=TRUE wrapper.lockfile=/var/lock/subsys/ActiveMQ
root       2942   2940  0 05:16 ?        00:00:13 java -Dactivemq.home=../.. -Dactivemq.base=../.. -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStore=../../conf/broker.ks -Djavax.net.ssl.trustStore=../../conf/broker.ts -Dcom.sun.management.jmxremote -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dactivemq.conf=../../conf -Dactivemq.data=../../data -Djava.security.auth.login.config=../../conf/login.config -Xmx1024m -Djava.library.path=../../bin/linux-x86-64/ -classpath ../../bin/wrapper.jar:../../bin/activemq.jar -Dwrapper.key=hhmTPupfiMoDGbve -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=2940 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.apache.activemq.console.Main start
root       3009   2252  0 05:51 pts/1    00:00:00 grep --color=auto activemq

檢視8161和61616埠

[root@node1 linux-x86-64]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1055/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2180/master         
tcp        0      0 127.0.0.1:32000         0.0.0.0:*               LISTEN      2942/java           
tcp6       0      0 :::8161                 :::*                    LISTEN      2942/java           
tcp6       0      0 :::5672                 :::*                    LISTEN      2942/java           
tcp6       0      0 :::61613                :::*                    LISTEN      2942/java           
tcp6       0      0 :::61614                :::*                    LISTEN      2942/java           
tcp6       0      0 :::61616                :::*                    LISTEN      2942/java           
tcp6       0      0 :::60753                :::*                    LISTEN      2942/java           
tcp6       0      0 :::22                   :::*                    LISTEN      1055/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      2180/master         
tcp6       0      0 :::1883                 :::*                    LISTEN      2942/java

Web測試存取: http://ip地址:8161 使用者名稱:admin  密碼:admin

推薦閱讀:

Spring+Log4j+ActiveMQ實現遠端記錄紀錄檔——實戰+分析 http://www.linuxidc.com/Linux/2015-12/126163.htm

Spring下ActiveMQ實戰  http://www.linuxidc.com/Linux/2015-11/124854.htm

Java訊息佇列--ActiveMQ 實戰 http://www.linuxidc.com/Linux/2016-12/138848.htm

CentOS 6.5啟動ActiveMQ報錯解決 http://www.linuxidc.com/Linux/2015-08/120898.htm

ActiveMQ的簡單使用  http://www.linuxidc.com/Linux/2017-03/142053.htm

ActiveMQ部署步驟和後台管理網站Service Unavailable問題解決  http://www.linuxidc.com/Linux/2016-11/137050.htm

Linux環境下面ActiveMQ埠號設定和WEB埠號設定 http://www.linuxidc.com/Linux/2012-01/51100.htm

本文永久更新連結地址http://www.linuxidc.com/Linux/2017-12/149912.htm


IT145.com E-mail:sddin#qq.com