本文由 简悦 SimpRead 转码, 原文地址 www.cnblogs.com
- 存储库 (remi,ius,webtatic)
一 redis
- 安装 redis4/5 版本通过 IUS 存储库 (仅支持 redhat/centos)
安装 epel repo
yum install -y epel-release bash-completion
安装 IUS repo
- 社群版
yum install -y https://centos7.iuscommunity.org/ius-release.rpm
- 官网版语法
yum install -y https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装 redis5
yum install -y redis5
启动 redis
systemctl start redis
- 安装 redis6 / 最新版本通过 remi 存储库
安装 remix repo
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -ivh remi-release-7.rpm
安装 redis6
yum --enablerepo=remi install redis
启动 redis6
systemctl start redis
二 rabbitmq
- 导入 repo
如果失效请查阅:https://www.rabbitmq.com/install-rpm.html
vim /etc/yum.repos.d/rabbitmq.repo
# In /etc/yum.repos.d/rabbitmq.repo
##
## Zero dependency Erlang
##
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
- 安装 RabbitMQ server
# 安装erlang
yum install erlang -y
# 下载rpm包
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.14/rabbitmq-server-3.7.14-1.el7.noarch.rpm
# 安装
yum install rabbitmq-server-3.7.14-1.el7.noarch.rpm
# rpm -qi rabbitmq-server
- 开放端口
# firewall-cmd --zone=public --add-port={5671,5672,15672}/tcp --permanent
# firewall-cmd --reload
- 启动服务
# systemctl enable --now rabbitmq-server
# rabbitmq-plugins enable rabbitmq_management # 开启管理界面
- 创建账号并授权
# rabbitmqctl add_user admin admin
# rabbitmqctl set_user_tags admin administrator
# rabbitmqctl set_permissions admin ".*" ".*" ".*"
---
# rabbitmqctl list_users # 查看用户列表
# rabbitmqctl list_permissions #查看权限列表
三 单节点 consul
下载 consul
wget https://releases.hashicorp.com/consul/1.7.3/consul_1.7.3_linux_amd64.zip
解压并安装 consul
unzip consul_1.7.3_linux_amd64.zip
mv consul /bin/
创建配置文件和用户
# mkdir -p /opt/consul/conf
# mkdir -p /opt/consul/data
# useradd -M -s /sbin/nologin consul
#vim /opt/consul/conf/server.json
{
"datacenter": "dc1",
"data_dir": "/opt/consul/data",
"log_level": "INFO",
"node_name": "consul-server01",
"server": true,
"bootstrap_expect": 1,
"bind_addr": "192.168.100.9",
"client_addr": "0.0.0.0",
"enable_debug": false,
"enable_syslog": true,
"syslog_facility": "local0"
}
授权目录
chown -R consul.consul /opt/consul/
配置 systemctl 管理和日志
# vim /etc/systemd/system/consul.service
[Unit]
Description=Consul service discovery agent
Requires=network-online.target
After=network-online.target
[Service]
User=consul
Group=consul
Restart=on-failure
ExecStart=/bin/consul agent -syslog -ui -config-dir=/opt/consul/conf
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
TimeoutStopSec=5
[Install]
WantedBy=multi-user.target
- 配置日志
在最后追加一行
# vim /etc/rsyslog.conf
local0.* /opt/consul/consul.log
# 重启 rsyslog
# systemctl restart rsyslog.service
- 启动 consul
systemctl start consul
致谢
https://ius.io/
https://plone.lucidsolutions.co.nz/linux/centos/ius-repository-for-centos-7
https://www.linuxhelp.com/how-to-install-redis-5-on-centos-7-6
https://www.rabbitmq.com/install-rpm.html
https://blog.yowko.com/