- 存储库(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
- 安装 erlang
# yum install -y wget epel-release
# wget https://github.com/rabbitmq/erlang-rpm/releases/download/v21.3.8.6/erlang-21.3.8.6-1.el7.x86_64.rpm
# yum install -y erlang-21.3.8.6-1.el7.x86_64.rpm
- 导入密钥和安装 RabbitMQ repo
# rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
# vim /etc/yum.repos.d/rabbitmq.repo
[bintray-rabbitmq-server]
name=bintray-rabbitmq-rpm
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.8.x/el/7 # 如果是Centos8最后的数字修改为8
gpgcheck=0
repo_gpgcheck=0
enabled=1
- 安装 RabbitMQ server
# yum install -y rabbitmq-server
# 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
# useradd -M -s /sbin/nologin consul
#vim /opt/consul/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/