Start learning to use ActiveMQ today. Before learning, we deploy ActiveMQ on the server.
The author recommends downloading from Official Website.
The next step is to install activemq.
You can directly click the download address above and upload to the server via FTP tool. (FileZilla etc.)
You can also use the wget
tool to operate on the server.
wget http://mirror.bit.edu.cn/apache//activemq/5.15.11/apache-activemq-5.15.11-bin.tar.gz
If there is no wget command on the server, you can install wget
through yum -y install wget
We install activemq
into the /var
directory
## First unzip to/var directory
tar -xvf apache-activemq-5.15.11-bin.tar.gz -C /var
## Apache-activemq-5.15.11 Rename
mv /var/apache-activemq-5.15.11/var/activemq
First we enter the installation directory: /var/activemq
Start the service: ./bin/activemq start
Stop the service: ./bin/activemq stop
vi /usr/lib/systemd/system/activemq.service
[ Unit]
Description=ActiveMQ service
After=network.target
[ Service]
Type=forking
ExecStart=/var/activemq/bin/activemq start
ExecStop=/var/activemq/bin/activemq stop
User=root
Group=root
Restart=always
RestartSec=9
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=activemq
[ Install]
WantedBy=multi-user.target
whereis java
JAVA_HOME
in activemq configuration file /var/activemq/bin/env
# Location of the java installation
# Specify the location of your java installation using JAVA_HOME, or specify the
# path to the "java" binary using JAVACMD
# ( set JAVACMD to "auto"for automatic detection)
JAVA_HOME=" /var/java/jdk1.8.0_241"
JAVACMD="auto"
systemctl
systemctl start activemq
systemctl status activemq
If you want to start automatically after booting, you can run the following command:
ln -s /usr/lib/systemd/system/activemq.service /etc/systemd/system/multi-user.target.wants/activemq.service
systemctl enable activemq
systemctl list-unit-files |grep activemq
If we access remotely, there may be a firewall problem. We can turn off the firewall through the following name.
Firewall configuration, the default Web management port of ActiveMQ is 8161 (admin/admin), and the default communication port is 61616
firewall-cmd --zone=public--add-port=8161/tcp --permanent
firewall-cmd --zone=public--add-port=61616/tcp --permanent
systemctl restart firewalld.service
systemctl stop firewalld.service
The configuration file of ActiveMQ web management system is in: /var/activemq/conf
< bean id="jettyPort"class="org.apache.activemq.web.WebConsolePort" init-method="start"><!-- the default port number for the web console --><property name="host" value="0.0.0.0"/><!--This is the port of the management platform--><property name="port" value="8161"/></bean>
< bean id="securityConstraint"class="org.eclipse.jetty.util.security.Constraint"><property name="name" value="BASIC"/><property name="roles" value="user,admin"/><!--Change to false to close login--><property name="authenticate" value="true"/></bean>
Other configuration files are in: /var/activemq/conf/jetty-realm.properties
## ---------------------------------------------------------------------------
# The account password can be maintained here, format:
# username:password,Roles
# Defines users that can access the web(console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin
user:123, user
The above is the basic process of installing ActiveMQ under Centos7 without any problems.
Recommended Posts