activeMQ环境搭建及测试

activeMQ环境搭建

如果没有javac
文件下载

版本5.16.0下载地址

文件解压
 wget http://www.apache.org/dyn/closer.cgi?filename=/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz&action=download
 tar xzf apache-activemq-5.16.0-bin.tar.gz
 mv apache-activemq-5.16.0 activemq-5.16.0
修改默认端口
 cd activemq-5.16.0/conf/
 vim jetty.xml
<property name="host" value="127.0.0.1"/>
<property name="port" value="40066"/>	//端口号
修改密码(在此文件中)
[root@localhost conf]# vim jetty-realm.properties
systemd自启动配置参考文档
 cd /lib/systemd/system/
 vim activemq.service 

写入如下内容:

[Unit]
Description=ActiveMQ service
After=network.target

[Service]
Type=forking
ExecStart=/home/activemq-5.16.0/bin/activemq start
ExecStop=/home/activemq-5.16.0/bin/activemq stop
User=root
Group=root
Restart=always
RestartSec=9
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=activemq

[Install]
WantedBy=multi-user.target

注意:

ExecStart=替换成你的路径 start
ExecStop=替换成你的路径 stop

系统启动
systemctl daemon-reload
systemctl enable activemq
systemctl start activemq
systemctl status activemq

注释:

systemctl daemon-reload 	# 重新加载下服务文件
systemctl enable activemq	# 开机自启服务
systemctl start activemq	# 启动服务
systemctl status activemq	# 关闭服务

安装依赖包CppUnit


 wget https://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz
 tar -zxvf cppunit-1.12.1.tar.gz
 cd cppunit-1.12.1
 ./configure  --prefix=/usr/local/cppunit/
 make
 makeinstall

安装apr
 wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
 tar -xzvf apr-1.7.0.tar.gz
 cd apr-1.7.0
 ./configure --prefix=/usr/local/apr/ 
 make 
 make install
  • 错误

    注意:在执行configure可能会出现
     rm: cannot remove `libtoolT': No such file or directory错误信息。网上查阅了一下资料,提示编辑configure这个文件,将 $RM “$cfgfile” 那行注释掉 ,然后重新编译即可
    

安装apr-util
 wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
 tar xzvf apr-util-1.6.1.tar.gz 

 ./configure --prefix=/usr/local/aprutil --with-apr=/usr/local/apr/ 
 make 
 make install
  • 报错

make的时候如果出现

xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
 #include <expat.h>
 yum install -y  expat-devel

安装APR iconv
 wget https://mirror.bit.edu.cn/apache//apr/apr-iconv-1.2.2.tar.gz
 tar xzvf apr-iconv-1.2.2.tar.gz 
 cd apr-iconv-1.2.2/
 ./configure --prefix=/usr/local/apr-iconv/ --with-apr=/usr/local/apr/ 
 make 
 make install

安装openssl
 wget http://www.openssl.org/source/openssl-1.0.0a.tar.gz
 tar xzvf openssl-1.0.0a.tar.gz 

 cd openssl-1.0.0a/
 ./config --prefix=/usr/local/openssl/ 
 make
 make install
  • 如果是下面的报错话

    cms.pod around line 457: Expected text after =item, not a number 
    cms.pod around line 461: Expected text after =item, not a number 
    cms.pod around line 465: Expected text after =item, not a number 
    cms.pod around line 470: Expected text after =item, not a number 
    cms.pod around line 474: Expected text after =item, not a number 
    POD document had syntax errors at /usr/bin/pod2man line 69. 
    #请输入:
    rm -f /usr/bin/pod2man 
    

安装编译activeMQ-cpp
yum  install libssl-dev
yum  install openssl*
 http://archive.apache.org/dist/activemq/activemq-cpp/3.9.4/activemq-cpp-library-3.9.4-src.tar.gz
 tar xzf activemq-cpp-library-3.9.4-src.tar.gz 
 mv activemq-cpp-library-3.9.4 activemq-cpp-3.9.4
 cd activemq-cpp-3.9.4/
./configure --prefix=/usr/local/ActiveMQ-CPP --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/aprutil --with-cppunit=/usr/local/cppunit --with-openssl=/usr/local/openssl 
make 
make install 
测试是否可行的测试代码

请点击查看博客

借鉴博客

Linux下安装ActiveMQ CPP
Linux 下的 ActiveMQ C++ 环境搭建与测试

activeMq-CPP的使用

posted @ 2020-10-11 17:19  缄默先生  阅读(393)  评论(0编辑  收藏  举报