环境说明:

aws AMI 内核4.14.33-59.37.amzn2.x86_64 #1 SMP Thu May 3 21:25:31 UTC 2018


首先安装JDK环境,1.8.0版本:

1、下载jdk1.8.0版本,并安装,默认安装在/usr/java/目录下;

# wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm

# rpm -ivh jdk-8u131-linux-x64.rpm


2、新建目录,移动jdk到新建目录中

mkdir -p /vst/local/jdk

mv /usr/java/jdk1.8.0_131/* /vst/local/jdk/

cd /vst/local/jdk/

3、JDK加入环境变量,并source生效;查看java版本;

[root@ip-172-30-51-64 jdk]#vi /etc/profile

JAVA_HOME=/vst/local/jdk

CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME CLASSPATH

[root@ip-172-30-51-64 jdk]# source /etc/profile

[root@ip-172-30-51-64 jdk]# 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 5.14.4版本

1、下载apache-activemq5.14.4版本,并解压;

[root@ip-172-30-51-64 apache-activemq]# wget https://archive.apache.org/dist/activemq/5.14.4/apache-activemq-5.14.4-bin.tar.gz

tar -xvf apache-activemq-5.14.4-bin.tar.gz


2、建立新目录,移动mq到新建目录中;删除解压的空目录;

mkdir -p /vst/local/apache-activemq

mv apache-activemq-5.14.4/* /vst/local/apache-activemq/

rm -rf apache-activemq-5.14.4

cd /vst/local/apache-activemq/


3、进入bin目录下,启动mq,查看mq进程,监听端口8161,61616;

[root@ip-172-30-51-64 bin]# ./activemq start

INFO: Loading '/vst/local/apache-activemq//bin/env'

INFO: Using java '/vst/local/jdk/bin/java'

INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details

INFO: pidfile created : '/vst/local/apache-activemq//data/activemq.pid' (pid '8851')

[root@ip-172-30-51-64 bin]# ps -ef |grep java

root      8851     1 73 01:20 pts/0    00:00:05 /vst/local/jdk/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/vst/local/apache-activemq//conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/vst/local/apache-activemq//tmp -Dactivemq.classpath=/vst/local/apache-activemq//conf:/vst/local/apache-activemq//../lib/: -Dactivemq.home=/vst/local/apache-activemq/ -Dactivemq.base=/vst/local/apache-activemq/ -Dactivemq.conf=/vst/local/apache-activemq//conf -Dactivemq.data=/vst/local/apache-activemq//data -jar /vst/local/apache-activemq//bin/activemq.jar start

[root@ip-172-30-51-64 ~]# netstat -nltp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3139/master

tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3270/sshd

tcp6       0      0 :::1883                 :::*                    LISTEN      8851/java

tcp6       0      0 :::8161                 :::*                    LISTEN      8851/java

tcp6       0      0 :::5672                 :::*                    LISTEN      8851/java

tcp6       0      0 :::61613                :::*                    LISTEN      8851/java

tcp6       0      0 :::61614                :::*                    LISTEN      8851/java

tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd

tcp6       0      0 :::61616                :::*                    LISTEN      8851/java

tcp6       0      0 :::35635                :::*                    LISTEN      8851/java

tcp6       0      0 :::22                   :::*                    LISTEN      3270/sshd


4、本地curl测试

[root@ip-172-30-51-64 apache-activemq]# curl localhost:8161 -I

HTTP/1.1 200 OK

Date: Fri, 22 Jun 2018 02:27:09 GMT

X-FRAME-OPTIONS: SAMEORIGIN

Content-Type: text/html

Content-Length: 6047

Server: Jetty(9.2.13.v20150730)


5、浏览器 http://ip:8161 访问,用户名admin 密码admin

QQ20200721-092932.png