项目运行环境 快速搭建JDK Mysql Nginx Redis RabbitMQ

前言

centos 7 快速搭建java 项目运行环境

  • jdk-8u171
  • Mysql 5.7.x
  • Nginx 1.16.x
  • Redis 5.0.7
  • RabbitMQ 3.6.15

一、安装JDK

  1. 找到下载地址 jdk-8u171-linux-x64.tar.gz 171下载地址
  2. 执行命令
wget https://github.com/frekele/oracle-java/releases/download/8u171-b11/jdk-8u171-linux-x64.tar.gz
tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr
update-alternatives --install /usr/bin/java java /usr/jdk1.8.0_171/bin/java 3
java -version

二、安装Mysql

wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server
mysqld --initialize-insecure --user=mysql 
service mysqld start
mysql -uroot -p #回车
# 配置远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
# 配置本地连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '密码' WITH GRANT OPTION;
FLUSH PRIVILEGES;

三、安装Nginx

#选择二进制安装
wget https://raw.githubusercontent.com/helloxz/nginx-cdn/master/nginx.sh && bash nginx.sh

安装完成后执行命令 source /etc/profile 让环境变量立即生效,或重新打开终端。

  • 启动nginx:nginx
  • 停止nginx:nginx -s stop
  • 重载nginx:nginx -s reload
  • 语法检测:nginx -t

四、安装Redis

wget http://download.redis.io/releases/redis-5.0.7.tar.gz
tar zxvf redis-5.0.7.tar.gz
cd redis-5.0.7
make MALLOC=libc
cd src && make install

修改redis.conf
daemonize no
修改成
daemonize yes

#启动
./src/redis-server ./redis.conf

五、安装RabbitMQ

因为是erlang语音开发的,安装erlang

wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm
rpm -ivh erlang-19.0.4-1.el7.centos.x86_64.rpm
erl -version

安装RabbitMQ

wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.15/rabbitmq-server-3.6.15-1.el7.noarch.rpm
yum -y install socat #安装依赖
rpm -ivh rabbitmq-server-3.6.15-1.el7.noarch.rpm #安装
service rabbitmq-server start #启动
rabbitmqctl add_user admin admin #添加用户
rabbitmqctl set_user_tags admin administrator #设置用户权限组
rabbitmqctl list_users #查看用户列表

安装延迟队列插件 rabbitmq_delayed_message_exchange

#下载插件
wget  https://dl.bintray.com/rabbitmq/community-plugins/3.6.x/rabbitmq_delayed_message_exchange/rabbitmq_delayed_message_exchange-20171215-3.6.x.zip
yum -y install unzip  # 安装 unzip
unzip rabbitmq_delayed_message_exchange-20171215-3.6.x.zip #解压
#拷贝
cp -r rabbitmq_delayed_message_exchange-20171215-3.6.x.ez /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.15/plugins/ 
#开启插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange

开启RabbitMQ 管理界面

rabbitmq-plugins enable rabbitmq_management

原文地址:http://www.idmiss.com/542

你可能感兴趣的:(项目运行环境 快速搭建JDK Mysql Nginx Redis RabbitMQ)