CentOS 7でActiveMQをインストールし、サービス設定を登録して起動
7409 ワード
【1】バイナリインストールパッケージのダウンロード
ダウンロード先:http://activemq.apache.org/activemq-5152-release.html
【2】解凍インストール
サーバ/usr/localパスにアップロードし、解凍します.
フォルダに入ります.その内容は次のとおりです.
【3】ActiveMQの起動
binディレクトリの起動:
プロンプトに権限がない場合は、次のコマンドを使用します.
【4】テストインストール
ActiveMQのデフォルトでは、サービスポートとして61616、管理リスニングポートとして8161が使用されます.
端末使用コマンドテスト:
ローカルブラウザアクセス管理アドレス:
デフォルトのユーザー名パスワードはadmin adminです.
ブラウザがアクセスできない場合は、ファイアウォールの上にポート8161を開いてみてください.
【5】ユーザーの追加
参照ページ:http://activemq.apache.org/security.html
Activemqを変更します.xml:
brokerラベルの内部に次のように構成を追加します.
ActiveMQを再起動します.
【6】ソフトチェーンを追加し、任意の場所でActiveMQを起動する
コマンドは次のとおりです.
【7】サービスを登録し、起動を設定する
/etc/init.d/の下にactivemqファイルを追加する:
ファイルに権限を付与するには、次の手順に従います.
chmod 777/etc/init.d/activemq
起動の設定:
chkconfig activemq on
起動サービスの一覧を表示するには、次の手順に従います.
chkconfig –list
電源を切って起動します.
chkconfig activemq off
Activemqの起動:
Activemqを閉じる:
Activemqステータスを表示するには、次の手順に従います.
Activemqを再起動するには:
起動テスト:
ダウンロード先:http://activemq.apache.org/activemq-5152-release.html

【2】解凍インストール
サーバ/usr/localパスにアップロードし、解凍します.
tar -zxvf apache-activemq-5.15.2-bin.tar.gz

フォルダに入ります.その内容は次のとおりです.

【3】ActiveMQの起動
binディレクトリの起動:
bin/activemq start

プロンプトに権限がない場合は、次のコマンドを使用します.
chmod 755 ../../
【4】テストインストール
ActiveMQのデフォルトでは、サービスポートとして61616、管理リスニングポートとして8161が使用されます.
端末使用コマンドテスト:

ローカルブラウザアクセス管理アドレス:

デフォルトのユーザー名パスワードはadmin adminです.
ブラウザがアクセスできない場合は、ファイアウォールの上にポート8161を開いてみてください.
【5】ユーザーの追加
参照ページ:http://activemq.apache.org/security.html
Activemqを変更します.xml:
brokerラベルの内部に次のように構成を追加します.
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="hh_mq" password="hh_mq@123456" groups="users,admins"/>
users>
simpleAuthenticationPlugin>
plugins>

ActiveMQを再起動します.
【6】ソフトチェーンを追加し、任意の場所でActiveMQを起動する
コマンドは次のとおりです.
ln -s /usr/local/apache-activemq-5.15.2/bin/activemq /usr/bin/
【7】サービスを登録し、起動を設定する
/etc/init.d/の下にactivemqファイルを追加する:
#!/bin/sh
#
# /etc/init.d/activemq
# chkconfig: 345 63 37
# description: activemq servlet container.
# processname: activemq 5.15.2
# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network
export JAVA_HOME=/usr/local/jdk1.8.0_144
export ACTIVEMQ_HOME=/usr/local/apache-activemq-5.15.2
case $1 in
start)
sh $ACTIVEMQ_HOME/bin/activemq start
;;
stop)
sh $ACTIVEMQ_HOME/bin/activemq stop
;;
status)
sh $ACTIVEMQ_HOME/bin/activemq status
;;
restart)
sh $ACTIVEMQ_HOME/bin/activemq stop
sleep 1
sh $ACTIVEMQ_HOME/bin/activemq start
;;
esac
exit 0
ファイルに権限を付与するには、次の手順に従います.
chmod 777/etc/init.d/activemq
起動の設定:
chkconfig activemq on
起動サービスの一覧を表示するには、次の手順に従います.
chkconfig –list

電源を切って起動します.
chkconfig activemq off
Activemqの起動:
service activemq start
Activemqを閉じる:
service activemq stop
Activemqステータスを表示するには、次の手順に従います.
service activemq status
Activemqを再起動するには:
service activemq restart
起動テスト:
reboot