[LINUX] Install Apache ActiveMQ

Note

procedure

  1. Create a user to run ActiveMQ

    # useradd activemq
    
  2. Create the required directories

    # mkdir -p /var/log/activemq \
    

&& mkdir -p /var/lib/activemq ```

  1. Download the ActiveMQ binary in advance or download it with the following command

    # curl -LkvOf https://archive.apache.org/dist/activemq/5.15.11/apache-activemq-5.15.11-bin.tar.gz
    
  2. Deploy

    # tar zxvf apache-activemq-5.15.11-bin.tar.gz -C /opt/
    
  3. Make a symbolic link

    # ln -s /opt/apache-activemq-5.15.11 /opt/activemq
    
  4. Change the output destination of the log file.

    # vi /opt/activemq/conf/log4j.properties
    
    :%s/${activemq.data}/\/var\/log\/activemq/g
    
    # File appender
    log4j.appender.logfile=org.apache.log4j.RollingFileAppender
    log4j.appender.logfile.file=/var/log/activemq/activemq.log
    log4j.appender.logfile.maxFileSize=1024KB
    log4j.appender.logfile.maxBackupIndex=5
    log4j.appender.logfile.append=true
    log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
    log4j.appender.logfile.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
      
    ###########
    # Audit log
    ###########
    
    log4j.additivity.org.apache.activemq.audit=false
    log4j.logger.org.apache.activemq.audit=INFO, audit
    
    log4j.appender.audit=org.apache.log4j.RollingFileAppender
    log4j.appender.audit.file=/var/log/activemq/audit.log
    log4j.appender.audit.maxFileSize=1024KB
    log4j.appender.audit.maxBackupIndex=5
    log4j.appender.audit.append=true
    log4j.appender.audit.layout=org.apache.log4j.PatternLayout
    log4j.appender.audit.layout.ConversionPattern=%-5p | %m | %t%n
    
  5. Edit the configuration file

    # vi /opt/activemq/bin/linux-x86-64/wrapper.conf
    

#******************************************************************** # Wrapper Properties #********************************************************************

#wrapper.debug=TRUE
set.default.ACTIVEMQ_HOME=../..
set.default.ACTIVEMQ_BASE=../..
set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf
set.default.ACTIVEMQ_DATA=/var/lib/activemq #Change to the created directory
wrapper.working.dir=.

...

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=/var/log/activemq/wrapper.log  #Changed to place in the created directory

...
```
  1. Partially changed environment variables

    # vi /opt/activemq/bin/env
    
    # Configure a user with non root privileges, if no user is specified do not change user
    # (the entire activemq installation should be owned by this user)
    ACTIVEMQ_USER="activemq" #Change to the created user
    
    # location of the pidfile
    ACTIVEMQ_PIDFILE="/opt/activemq/data/activemq.pid" #Changed to place in the created directory
    
  2. Change the owner of various files to the execution user

    # chown -R activemq:activemq /opt/activemq/ /var/log/activemq/ /var/lib/activemq/
    
  3. Create a service file for ActiveMQ

```sh
# vi /etc/systemd/system/activemq.service
```

```service
[Unit]
Description=ActiveMQ message queue service
After=network.target

[Service]
User=activemq
Group=activemq
PIDFile=/opt/activemq/data/activemq.pid
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop

[Install]
WantedBy=multi-user.target
```
  1. Load and start the service file
```sh
# systemctl daemon-reload \

&& systemctl start activemq ```

reference

Recommended Posts

Install Apache ActiveMQ
Install Apache Zookeeper
Install Apache Zeppelin
Install Apache Maven (from source)
Install pytorch
Install Activiti 6
emacs-jedi install
ArcoLinux install
install python
Install virtualenv
Install mojimoji
Install Scipy
Install Memo
Install Qiskit
Install Ansible
install keras
Install Mu
How to install Apache (httpd) on CentOS7
Install Django
Install PyTorch
How to install Apache (httpd) on CentOS8
install pillow
ArchmanLinux Install