转自:http://bobo896.blog.163.com/blog/static/2731576920125255448541/
Rabbitmq 是用 erlang 语言写的,所以我们需要安装 Erlang,安装 erlang 又需要安装 python 与 simplejson,所以我们从python开始:
1、安装 python:
wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2
tar -jxvf Python-2.5.2.tar.bz2
cd Python-2.5.2
./configure
make && make install
【yasi】yum install 就好了
测试:在命令行下输入python,出现python解释器即表示已经正确安装。
2、安装 simplejson:
3、安装 erlangwget http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz
tar zxvf simplejson-2.0.9.tar.gz
cd simplejson-2.0.9
python setup.py build
python setup.py install
【yasi】yum search simplejson 然后 yum install python-simplejson.x86_64 (64 bit 为例)就可以了
4、安装 RabbitMQwget http://www.erlang.org/download/otp_src_R13B04.tar.gz
tar zxvf otp_src_R13B04.tar.gzcd otp_src_R13B04./configuremake && make install【yasi】已经有 otp_src_R15B03.tar.gz 了 ;如果configure时提示没有curses,就yum install ncurses.x86_64 ncurses-devel.x86_64(64 bit 为例)
5、启动RabbitMQwget http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.4/rabbitmq-server-2.8.4.tar.gz
tar -zxf rabbitmq-server-2.8.4.tar.gz
cd rabbitmq-server-2.8.4
make TARGET_DIR=/usr/local/webserver/rabbitmq SBIN_DIR=/usr/local/webserver/rabbitmq/sbin MAN_DIR=/usr/local/webserver/rabbitmq/man install
【yasi】已经有rabbitmq-server-3.1.0.tar.gz了,make时如果提示没有xmlto,就yum install xmlto.x86_64(64 bit 为例)
注:/usr/local/webserver/rabbitmq/sbin/rabbitmq-server
或者后台运行
nohup ./rabbitmq-server start > nohup.out
【yasi】nohup /usr/local/webserver/rabbitmq/sbin/rabbitmq-server &
创建/etc/rabbitmq/enabled_plugins 文件,注意!并非文件夹。Activating RabbitMQ plugins ... {"init terminating in do_boot",{{nocatch,{error,{cannot_read_enabled_plugins_file,"/etc/rabbitmq/enabled_plugins",eisdir}}},[{init,start_it,1},{init,start_em,1}]}}
重启php 跟 nginx ,查看phpinfo(),amqp是否安装成功wget http://pecl.php.net/get/amqp-1.0.3.tgz
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-amqp
make && make install
rabbitmq-plugins enable rabbitmq_management
重新启动RabbitMQ,输入http://server-name:55672/mgmt/ 就能够进入到监控页面。默认的用户名和密码是: guest 和 guest。如图:
【yasi】安装时遇到下面的错误提示:
Error: {cannot_write_enabled_plugins_file,”/etc/rabbitmq/enabled_plugins”, enoent}
解决方法:mkdir /etc/rabbitmq; /usr/local/rabbitmq/sbin/rabbitmq-plugins enable rabbitmq_management
2)需要安装xmltoPlease set SBIN_DIR. make: *** [install_dirs] 错误 1
否则会出现如下报错:yum install xmlto
rabbitmq-plugins enable rabbitmq_management