離線安裝rabbitMQ

安裝步驟

總體軟件環境

|軟件|版本|
|-|-|
|RHEL |7 update3|
|Erlong|19.3|
|rabbitMQ|3.6.10|html

Erlong語言安裝離線安裝

rabbitMQ是使用erlang這種編程語言開發的,因此安裝rabbitMQ的前提是安裝Erlong語言。此次全都是離線安裝,以便在遠離internet的生產環境部署。java

軟件依賴清單

|編譯報錯|解決辦法|下載網址|
|-|-|-|
|crypto : No usable OpenSSL found |yum install openssl openssl-devel|rhel7.3光盤自帶,創建本地源|
|jinterface : No Java compiler found| rpm -ivh jdk-8u144-linux-x64.rpm|http://www.oracle.com/technet...
|odbc : ODBC library - link check failed| rpm -ivh unixODBC-2.3.1-11.el7.x86_64.rpm unixODBC-devel-2.3.1-11.el7.x86_64.rpm|ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/unixODBC-2.3.1-11.el7.x86_64.rpm ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/unixODBC-devel-2.3.1-11.el7.x86_64.rpm|
|ssh : No usable OpenSSL found|yum install openssl openssl-devel|rhel7.3光盤自帶,創建本地源|
|ssl : No usable OpenSSL found|yum install openssl openssl-devel|rhel7.3光盤自帶,創建本地源|node

依賴安裝

編譯Erlong還須要安裝ncurses,也是rhel7.3光盤自帶。以及fop(生成文檔用),centos7光盤有,rhel7光盤中沒有。python

yum install  fop
yum install  ncurses-devel ncurses
yum install openssl openssl-devel
rpm -ivh unixODBC-2.3.1-11.el7.x86_64.rpm unixODBC-devel-2.3.1-11.el7.x86_64.rpm
rpm -ivh jdk-8u144-linux-x64.rpm

wxWidge安裝(待補充,非必要部件)

Erlong軟件包準備

下載網址 http://erlang.org/download/
對應的版本自選,我選擇的是 19.3版本
http://erlang.org/download/ot...linux

Erlong編譯安裝

cd /tmp
wget http://erlang.org/download/otp_src_19.3.tar.gz
tar -zxvf otp_src_19.3.tar.gz
cd otp_src_19.3
./configure -prefix=/usr/local/erlang
make
make install
cd /usr/local/erlang
cd bin
ln -s /usr/local/erlang/bin/erl /usr/local/bin/erl

Erlong版本檢查

erl -v

RabbitMQ離線安裝

軟件下載

下載連接
http://www.rabbitmq.com/relea...git

離線安裝

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-generic-unix-3.6.10.tar.xz
tar -Jxvf rabbitmq-server-generic-unix-3.6.10.tar.xz 
tar -xvf rabbitmq-server-generic-unix-3.6.10.tar 
cp -R rabbitmq_server-3.6.10/   /usr/local/rabbitmq/
chmod -R 755 /usr/local/rabbitmq/sbin

RabbitMQ基本操做

rabbitMQ啓動

cd /usr/local/rabbitmq/sbin
./rabbitmq-server

開啓Web管理插件

cd /usr/local/rabbitmq/sbin
./rabbitmq-plugins enable rabbitmq_management

rabbitMQ重啓

cd /usr/local/rabbitmq/sbin
./rabbitmqctl stop   ## 停應用
./rabbitmq-server    ## 啓動應用

經過web管理

訪問http://localhost:15672
默認用戶/密碼 : guest/guest
注意初始狀態只能本地登陸,不可經過遠程web訪問,給權限也不行。須要遠程訪問的,必須新建用戶並賦權限。github

用戶管理並賦權限

  1. 添加用戶
    如用戶名:mqadmin 密碼:mqadmin
cd /usr/local/rabbitmq/sbin
./rabbitmqctl add_user mqadmin mqadmin
  1. 給用戶添加角色
    角色有none、management、policymaker、monitoring、administrator等,administrator爲超級管理員
./rabbitmqctl set_user_tags mqadmin administrator
  1. 給用戶受權
./rabbitmqctl set_permissions -p  / mqadmin '.*' '.*' '.*'

在瀏覽器中輸入:http://ip:15672 如:http://192.168.137.200:15672/便可
輸入新添加的用戶名和密碼登陸web

經常使用端口清單

|端口|說明|
|-|-|
|4369| epmd, a peer discovery service used by RabbitMQ nodes and CLI tools|
|5672, 5671| used by AMQP 0-9-1 and 1.0 clients without and with TLS|
|25672| used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.|
|15672| HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)|
|61613, 61614| STOMP clients without and with TLS (only if the STOMP plugin is enabled)|
|1883, 8883| (MQTT clients without and with TLS, if the MQTT plugin is enabled|
|15674| STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)|
|15675| MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)|編程

python環境(anaconda)安裝pika客戶端

基於anaconda環境,下載pika離線包
https://anaconda.org/conda-fo...ubuntu

cd /tmp
wget  https://anaconda.org/conda-forge/pika/0.10.0/download/linux-64/pika-0.10.0-py36_0.tar.bz2
conda install pika-0.10.0-py36_0.tar.bz2 
conda list | grep pika ##檢查

結論

綜上,一個基本的開源MQ環境搭建完成,最重要的是離線安裝脫離了internet的捆綁。

參考資料

http://erlang.org/doc/install...
https://sites.google.com/site...
https://www.rabbitmq.com/netw...
https://github.com/linux-on-i...
https://gist.github.com/craig...
http://blog.csdn.net/amuseme_...

相關文章
相關標籤/搜索