当前位置:   article > 正文

linux安装rabbitmq到指定位置,linux非root用户安装rabbitmq

make rabbitmq 源码到指定位置

因为rabbitmq是用erlang语言写的,所以装rabbitmq前必须先装好erlang。

我们到erlang官网https://www.erlang.org/downloads下载安装包,最新版本是22.0,下载时又被windows禁掉了,退而求其次,下21.3版本吧:

下完后通过rz上传至wlf用户soft目录下,执行解压:

$ tar xvf otp_src_21.3.tar

配置下目录前缀,通过make命令开始编译、安装,貌似编译时间有点久:

$ cd otp_src_21.3$ make

结束后通过bin/erl命令确认安装成功:

$ erl

Erlang/OTP 21 [erts-10.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V10.3 (abort with ^G)1>halt()1> .

halt是退出系统的方法,别忘了下面的点。

配置Erlang环境变量:

$ cd ~

$ vi .bash_profile

在bash_profile最后加入export PATH=$PATH:/home/wlf/erlang/bin这一行:

# .bash_profile

#Get the aliases andfunctionsif [ -f ~/.bashrc ]; then. ~/.bashrc

fi

# User specific environmentandstartup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

# Java_Home

JAVA_HOME=/home/wlf/jdk1.8.0_221

CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/libPATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

export PATH CLASSPATH JaVA_HOME

# erlang

export PATH=$PATH:/home/wlf/otp_src_21.3/bin

保存后让它生效:

$ source .bash_profile

注意普通用户没法通过yum安装ncurses-devel、openssl-devel等依赖,也没法执行make install,所以上面并没有这些操作。

搞定了erlang,再开始搞rabbitmq。同理,先去官网http://www.rabbitmq.com/download.html下载安装包,我们选通过git下载linux二进制版本的:

会有点慢,压缩包rabbitmq-server-generic-unix-3.7.18.tar.xz下好了通过rz上传到wlf的soft目录下,在soft目录下开始解压,需要分两步走,先解压xz,再解压tar:

$ xz -d rabbitmq-server-generic-unix-3.7.18.tar.xz

$ cd ..

$ tar xvf soft/rabbitmq-server-generic-unix-3.7.18.tar

rabbitmq是解压即可用的,但我们可以通过在配置文件来指定一些自定义设置,先进入配置目录:

cd rabbitmq_server-3.7.18/etc/rabbitmq/

再通过vi新增rabbitmq.env.conf指定数据节点名称和路径

#node name

NODENAME=rabbit#data dirMNESIA_BASE=/home/wlf/rabbitmq_server-3.7.18/data

同理,新增rabbitmq.conf指定端口等设置:

#listen port

listeners.tcp.default= 5673

#log dir

log.dir = /home/wlf/rabbitmq_server-3.7.18/logs#open remote request

loopback_users= none

配置完后记得手动创建日志目录logs。最后我们再次使用vi打开bash_profile配置下环境变量:

# .bash_profile

#Get the aliases andfunctionsif [ -f ~/.bashrc ]; then. ~/.bashrc

fi

# User specific environmentandstartup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

# Java_Home

JAVA_HOME=/home/wlf/jdk1.8.0_221

CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/libPATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

export PATH CLASSPATH JaVA_HOME

# erlang

export PATH=$PATH:/home/wlf/otp_src_21.3/bin

# rabbitmq

export PATH=$PATH:/home/wlf/rabbitmq_server-3.7.18/sbin

加上最后一行指定rabbitmq的执行目录之后,保存并用source命令让我们的配置生效。我们以后台进行方式启动rabbitmq:

$ rabbitmq-server -detatched

## ##

## ## RabbitMQ3.7.18. Copyright (C) 2007-2019Pivotal Software, Inc.

########## Licensed under the MPL. See https://www.rabbitmq.com/###### ##

########## Logs:/home/wlf/rabbitmq_server-3.7.18/var/log/rabbitmq/rabbit.log/home/wlf/rabbitmq_server-3.7.18/var/log/rabbitmq/rabbit_upgrade.log

Starting broker...

completedwith 0 plugins.

克隆会话登陆wlf,查看启动状态:

$ rabbitmqctl status

Statusof node rabbit@wlf-test188 ...

[{pid,10114},

{running_applications,

[{rabbit,"RabbitMQ","3.7.18"},

{mnesia,"MNESIA CXC 138 12","4.15.6"},

{sysmon_handler,"Rate-limiting system_monitor event handler","1.1.0"},

{rabbit_common,"Modules shared by rabbitmq-server and rabbitmq-erlang-client","3.7.18"},

{ranch,"Socket acceptor pool for TCP protocols.","1.7.1"},

{ssl,"Erlang/OTP SSL application","9.2"},

{public_key,"Public key infrastructure","1.6.5"},

{asn1,"The Erlang ASN1 compiler version 5.0.8","5.0.8"},

{observer_cli,"Visualize Erlang Nodes On The Command Line","1.5.2"},

{tools,"DEVTOOLS CXC 138 16","3.1"},

{os_mon,"CPO CXC 138 46","2.4.7"},

{recon,"Diagnostic tools for production use","2.5.0"},

{xmerl,"XML parser","1.3.19"},

{credentials_obfuscation,"Helper library that obfuscates sensitive values in process state","1.1.0"},

{jsx,"a streaming, evented json parsing toolkit","2.9.0"},

{crypto,"CRYPTO","4.4.1"},

{stdout_formatter,"Tools to format paragraphs, lists and tables as plain text","0.2.2"},

{inets,"INETS CXC 138 49","7.0.6"},

{lager,"Erlang logging framework","3.8.0"},

{goldrush,"Erlang event stream processor","0.1.9"},

{compiler,"ERTS CXC 138 10","7.3.2"},

{syntax_tools,"Syntax tools","2.1.7"},

{sasl,"SASL CXC 138 11","3.3"},

{stdlib,"ERTS CXC 138 10","3.8"},

{kernel,"ERTS CXC 138 10","6.3"}]},

{os,{unix,linux}},

{erlang_version,"Erlang/OTP 21 [erts-10.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:128] [hipe]\n"},

{memory,

[{connection_readers,0},

{connection_writers,0},

{connection_channels,0},

{connection_other,0},

{queue_procs,0},

{queue_slave_procs,0},

{plugins,11916},

{other_proc,26385104},

{metrics,195516},

{mgmt_db,0},

{mnesia,73328},

{other_ets,2453808},

{binary,160600},

{msg_index,29040},

{code,21581067},

{atom,1131721},

{other_system,13896508},

{allocated_unused,13412720},

{reserved_unallocated,0},

{strategy,rss},

{total,[{erlang,65918608},{rss,75112448},{allocated,79331328}]}]},

{alarms,[]},

{listeners,[{clustering,25672,"::"},{amqp,5673,"::"}]},

{vm_memory_calculation_strategy,rss},

{vm_memory_high_watermark,0.4},

{vm_memory_limit,10045002547},

{disk_free_limit,50000000},

{disk_free,132865421312},

{file_descriptors,

[{total_limit,65435},

{total_used,2},

{sockets_limit,58889},

{sockets_used,0}]},

{processes,[{limit,1048576},{used,231}]},

{run_queue,1},

{uptime,186},

{kernel,{net_ticktime,60}}]

可以看到启动成功,使用端口5673.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/457110
推荐阅读
相关标签
  

闽ICP备14008679号