CentOS 7 下安装 ActiveMQ 5.14.3

环境

[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

CentOS 7 下安装 ActiveMQ 5.14.3

推荐阅读:

相关推荐