0


Linux安装数据服务-MySQL、Redis、Java、RabbitMQ、Elasticsearch、MongoDB

1.MySQL 安装

 # 下载 MySQL yum包
 wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
 # 安装MySQL源
 rpm -Uvh mysql57-community-release-el7-10.noarch.rpm
 # 安装MySQL服务端
 yum install -y mysql-community-server
 # 可能遇到报错
 Failing package is: mysql-community-server-5.7.37-1.el7.x86_64
  GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 # 原因和解决方法 原因:由于MySQL GPG 密钥已过期导致的 解决办法:以2022年为例
 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
 # 安装MySQL服务端
 yum install -y mysql-community-server
 # 启动MySQL服务
 systemctl start mysqld.service
 # 查看MySQL服务启动状态
 systemctl status mysqld.service
 # 获取MySQL临时密码
 grep 'temporary password' /var/log/mysqld.log
 # 登录MySQL
 mysql -u root -p
 # 修改MySQL密码
 ALTER USER 'root'@'localhost' IDENTIFIED BY '@Rossi000000.';
 # 设置远程访问
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '@Rossi000000.' WITH GRANT OPTION;
 # 刷新权限
 FLUSH PRIVILEGES;

# 设置开机自启
 systemctl enable mysqld
 systemctl daemon-reload

# 开放端口
 firewall-cmd --state
 firewall-cmd --zone=public --add-port=3306/tcp --permanent
 firewall-cmd --reload

# 卸载MySQL
 rpm -qa | grep mysql
 yum -y remove mysql57-community-release-el7-10.noarch

2.Redis安装

yum install epel-release -y
yum install redis -y
systemctl start redis
systemctl status redis
vim /etc/redis.conf

 注释 #bind 127.0.0.1
 修改 protected-mode no
 修改 daemonize yes
 增加 requirepass password

systemctl restart redis
systemctl enable redis

3.jdk8安装

 tar -zxvf jdk-8u371-linux-x64.tar.gz
 cd /usr/local
 mkdir java
 cd /usr/local/java
 cp -rf /home/install-tmp/jdk1.8.0_371/* .
 vim /etc/profile
 export JAVA_HOME=/usr/local/java
 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 export PATH=$PATH:$JAVA_HOME/bin
 source /etc/profile

4.RabbitMq安装

 # 依赖准备
 yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tc xz
 # 安装erlang
 rpm -ivh erlang-24.3.4.3-1.el8.x86_64.rpm 
 # 检查erlang是否安装成功
 erl -v
 # 安装socat
 rpm -ivh socat-1.7.4.1-1.el8.x86_64.rpm 
 # 安装rabbitmq
 rpm -ivh rabbitmq-server-3.10.7-1.el8.noarch.rpm 
 # 安装rabbitmq管理页面插件
 rabbitmq-plugins enable rabbitmq_management
 # 设置开机自启
 chkconfig rabbitmq-server on
 # 启动rabbitmq
 systemctl start rabbitmq-server

# 用户操作
 # 查看用户列表
 rabbitmqctl list_users
 # 添加用户
 rabbitmqctl add_user 用户名 密码
 rabbitmqctl add_user admin 123456
 # 删除用户
 rabbitmqctl delete_user 用户名
 rabbitmqctl delete_user admin
 # 修改用户密码
 rabbitmqctl change_password 用户名 新密码
 rabbitmqctl change_password admin 666666
 # 设置用户角色
 rabbitmqctl set_user_tags admin administrator

# 浏览器访问后台
 # 开放5672和15672端口
 firewall-cmd --zone=public --add-port=5672/tcp --permanent && firewall-cmd --reload
 firewall-cmd --zone=public --add-port=15672/tcp --permanent && firewall-cmd --reload

http://服务器Ip:15672/

5.Elaserch安装

 # 需要安装Java并配置好JDK环境变量
 # 下载ES的
 elasticsearch-7.17.4-x86_64.rpm
 下载地址 https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-17-4
 # 配置ES的yum源
 vim /etc/yum.repos.d/elasticsearch.repo
 [elasticsearch]
 name=Elasticsearch repository for 7.x packages
 baseurl=https://artifacts.elastic.co/packages/7.x/yum
 gpgcheck=0
 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
 enabled=1
 autorefresh=1
 type=rpm-md
 # 刷新cache
 yum makecache
 # 执行elasticsearch安装
 yum install -y elasticsearch-7.17.4-x86_64.rpm
 # 配置和启动ES服务器进程
 systemctl daemon-reload
 systemctl enable elasticsearch
 systemctl start elasticsearch
 # 测试启动情况
 curl -X GET localhost:9200
 # 配置远程访问
 vim /etc/elasticsearch/elasticsearch.yml
 node.name: node-1
 network.host: 0.0.0.0
 http.port: 9200
 cluster.initial_master_nodes: [“node-1”]
 # 卸载
 rpm -qa|grep elasticsearch
 elasticsearch-2.4.6-1.noarch
 rpm -e --nodeps elasticsearch-2.4.6-1.noarch
 rm -rf /etc/elasticsearch
 # 可视化工具
 ElasticView

6.MongoDB安装

 # 可视化工具 mongodb-compass-1.43.0-win32-x64
 # 设置repo源 在etc目录下自动生成文件
 vi /etc/yum.repos.d/mongodb-org-4.2.repo
 [mongodb-org-4.2]
 name=MongoDB Repository
 baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
 gpgcheck=1
 enabled=1
 gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
 # 安装MongoDB
 yum -y install mongodb-org
 # 加载系统配置
 systemctl daemon-reload
 # 启动MongoDB
 systemctl start mongod
 # 验证MongoDB安装状态
 mongo
 # 设置开机自启
 systemctl enable mongod
 # 设置远程连接 bindIp: 0.0.0.0 所有IP都可进行连接
 vi /etc/mongod.conf
 net:
   port: 27017
   bindIp: 0.0.0.0
 # 可视化工具 Compass
标签: adb java linux

本文转载自: https://blog.csdn.net/RossiLover/article/details/141724360
版权归原作者 RossiLover 所有, 如有侵权,请联系我们删除。

“Linux安装数据服务-MySQL、Redis、Java、RabbitMQ、Elasticsearch、MongoDB”的评论:

还没有评论