centos7 安装rabbitmq
erlang安装
由于rabbitmq是基于erlang语言开发的,所以必须先安装erlang。
安装依赖
yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget gtk2-devel binutils-devel
erlang官网
wget https://ghproxy.com/github.com/erlang/otp/releases/download/OTP-24.2.1/otp_src_24.2.1.tar.gz
tar -zxvf /root/opt_src_24.2.1.tar.gz
mv otp_src_24.2.1 /usr/local/
cd /usr/local/otp_src_24.2.1/
mkdir ../erlang/
./configure --prefix=/usr/local/erlang
make install
echo 'export PATH=$PATH:/usr/local/erlang/bin' >> /etc/profile
source /etc/profile
中间可能会出现这个警告,直接忽略
测试
erl
halt().
安装rabbitmq
wget https://ghproxy.com/github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.13/rabbitmq-server-generic-unix-3.9.13.tar.xz
yum install -y xz
xz -d rabbitmq-server-generic-unix-3.9.13.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.9.13.tar
mv rabbitmq_server-3.9.13/ /usr/local/
cd /usr/local/
mv rabbitmq_server-3.9.13/ rabbitmq
echo 'export PATH=$PATH:/usr/local/rabbitmq/sbin' >> /etc/profile
source /etc/profile
配置rabbitmq
- 启动
rabbitmq-server -detached - 状态检查
rabbitmq-server -detached - 开启webui
rabbitmq-plugins enable rabbitmq_management - 访问localhost:15672
- 设置用户
rabbitmqctl list_users
rabbitmqctl add_user ricky mima
rabbitmqctl set_permissions -p "/" ricky "." "." ".*"
rabbitmqctl list_user_permissions ricky
rabbitmqctl set_user_tags ricky administrator
rabbitmqctl delete_user guest - 修改系统配置
vi /etc/sysctl.conf
fs.file-max = 100000
sysctl -p
vi /etc/security/limits.conf
-
soft nofile 65536
- hard nofile 65536
ulimit -n