系统版本:RockyLinux 8.6
安装方式:非容器化单机部署
安装版本:mysql 8.0.32 redis 6.2.11 rabbitmq 3.11.11 elasticsearch 6.7.1
前置条件:时间同步、关闭selinux、主机名、主机解析host
环境说明:PC电脑+VMware Workstation
xz -d mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz
tar -xf mysql-8.0.32-linux-glibc2.12-x86_64.tar
mv mysql-8.0.32-linux-glibc2.12-x86_64 /usr/local/mysql
mkdir /var/lib/mysql
mkdir -p /usr/local/mysql/log
mkdir /usr/local/mysql/data
# 编辑~/.bash_profile这个文件
# PATH新增内容/usr/local/mysql/bin后重新进入终端即可
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /var/lib/mysql
#vi /etc/my.cnf,内容如下:
[mysql]
default-character-set=utf8mb4
socket=/var/lib/mysql/mysql.sock
[mysqld]
port = 3306
socket=/var/lib/mysql/mysql.sock
basedir=/usr/local/mysql
character-set-server=utf8mb4
default-storage-engine=INNODB
innodb_buffer_pool_size = 200M
max_allowed_packet=16M
explicit_defaults_for_timestamp=1
log-output=FILE
general_log = 0
general_log_file=/usr/local/mysql/log/mysql-general.err
slow_query_log = ON
slow_query_log_file=/usr/local/mysql/log/mysql-query.err
long_query_time=10
log-error=/usr/local/mysql/log/mysql-error.err
default-authentication-plugin=mysql_native_password
#初始化数据库
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
#查看root密码
tail -100 /usr/local/mysql/log/mysql-error.err
# vi /usr/lib/systemd/system/mysqld.service 内容如下:
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 65536
LimitNPROC = 65536
systemctl daemon-reload
systemctl enable mysqld --now
systemctl status mysqld
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload
解决:mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5
# 本地连接测试一下
mysql -uroot -p
alter user 'root'@'localhost' identified by '1qaz2WSX';
create user 'root'@'%' identified by '1qaz2WSX';
grant all on *.* to 'root'@'%' with grant option;
flush privileges;
tar -xf redis-6.2.11.tar.gz
cd redis-6.2.11/
编译安装前提需要:gcc-c++ 、make 环境(已准备离线包)
# 注意执行目录切换
rpm -ivh make-4.2.1-11.el8.x86_64.rpm
rpm -Uvh *.rpm
编译环境准备好了以后,再次进入编译目录
cd redis-6.2.11
make && make install
# 编译安装后的二进制文件位于:/usr/local/bin
cd /usr/local/bin
# 复制配置文件(配置文件在编译安装的目录下)
cp /home/package/redis-6.2.11/redis.conf ./
# vi redis.conf,修改配置项:后台运行,设置密码,bind地址即可
bind 0.0.0.0
daemonize yes
requirepass 1qaz2WSX
redis-server redis.conf
firewall-cmd --permanent --add-port=6379/tcp
firewall-cmd --reload
rpm -ivh erlang-25.0-1.el8.x86_64.rpm
rpm -ivh rabbitmq-server-3.11.11-1.el8.noarch.rpm
systemctl enable rabbitmq-server --now
# 创建用户绑定vhost
rabbitmqctl add_user admin edoc2
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl set_user_tags admin administrator
rabbitmqctl delete_user guest
### 开启web端界面管理,监听15672端口
rabbitmq-plugins enable rabbitmq_management
### 重启服务生效,访问验证
systemctl restart rabbitmq-server
### 15672 web端管理界面
### 25672 集群管理端口
### 5672 AMQP端口,用于客户端应用程序的连接建立
firewall-cmd --permanent --add-port=15672/tcp
firewall-cmd --permanent --add-port=5672/tcp
firewall-cmd --reload