ActiveMQ のインストール
はじめに
このページでは ActiveMQ のインストール手順について説明します。
インストール対象の Alfresco Content Services でサポートされているバージョンのものを選択してください。
本手順に記載のバージョンは、サポート対象バージョンにあわせて適宜読み替えてください。
1.JAVA_HOME 環境変数の設定
JAVA_HOME を設定していない場合は、次のコマンドを実行して JAVA_HOME の環境変数を設定します。
実行コマンド
# echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | tee -a /etc/profile \
&& source /etc/profile2.実行用ユーザの作成
次のコマンドで activemq の実行用ユーザを作成します。
実行コマンド
# useradd activemq3.ActiveMQ のインストール
ActiveMQ のログとデータディレクトリを作成します
実行コマンド
# mkdir -p /var/log/activemq \
&& mkdir -p /var/lib/activemqActiveMQ の TAR ファイルをダウンロードします。
実行コマンド
# curl -LkvOf http://archive.apache.org/dist/activemq/5.16.2/apache-activemq-5.16.2-bin.tar.gz破損がないか確認します。(ハッシュ値は ダウンロードページ に記載されています)
実行コマンド
# sha512sum apache-activemq-5.16.2-bin.tar.gz実行結果
27bb26786640f74dcf404db884bedffc0af4bfb2a0248c398044ac9a13e19ff097c590b79eb1404e0b04d17a8f85a8f7de87186a96744e19162d70b3c7a9bdde apache-activemq-5.16.2-bin.tar.gzTAR ファイルを展開します
実行コマンド
# tar zxvf apache-activemq-5.16.2-bin.tar.gz -C /opt/シンボリックリンクを作成します
実行コマンド
# ln -s /opt/apache-activemq-5.16.2 /opt/activemqログ出力先を変更します
実行コマンド
# vi /opt/activemq/conf/log4j.propertiesvi コマンド実行後に実施するVimコマンド
:%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ログ及びデータ格納先を変更します
実行コマンド
# 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 ←変更
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 ←変更
(省略)env ファイルを編集して、実行ユーザ及び pid ファイルの設定を追記します
実行コマンド
# 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" ←変更
# location of the pidfile
ACTIVEMQ_PIDFILE="/opt/activemq/data/activemq.pid" ←変更 (必要に応じてコメント解除)所有者を実行ユーザに変更します
実行コマンド
# chown -R activemq:activemq /opt/activemq/ /var/log/activemq/ /var/lib/activemq/サービスファイルを作成します
実行コマンド
# vi /etc/systemd/system/activemq.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.targetActiveMQ を起動します
実行コマンド
# systemctl daemon-reload \
&& systemctl start activemqActiveMQ の自動起動を設定します
実行コマンド
# systemctl enable activemq