一、JDK1.8 环境搭建

1、上传文件解压

  1. [root@localhost mysoft]# tar -zxvf jdk-8u161-linux-x64.tar.gz
  2. [root@localhost mysoft]# pwd
  3. /usr/local/mysoft
  4. [root@localhost mysoft]# mv jdk1.8.0_161 jdk1.8

2、检查环境,已经安装删除

  1. [root@localhost mysoft]# ps -aux|grep java
  2. [root@localhost mysoft]# rpm -e --nodeps rpm -qa | grep java

3、配置环境变量

  1. [root@localhost /]# vim /etc/profile
  2. # 文件末尾追加 下面内容 shit+g 跳到文件末尾
  3. # JAVA_HOME
  4. export JAVA_HOME=/usr/local/mysoft/jdk1.8
  5. export PATH=$PATH:$JAVA_HOME/bin

4、检测安装成功

  1. [root@localhost /]# java -version
  2. openjdk version "1.8.0_161"
  3. OpenJDK Runtime Environment (build 1.8.0_161-b14)
  4. OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

二、TOMCAT8 安装

1、上传安装包

  1. [root@localhost mysoft]# tar -zxvf apache-tomcat-8.5.40.tar.gz
  2. [root@localhost mysoft]# mv apache-tomcat-8.5.40 tomcat8.5

2、启动服务

  1. [root@localhost bin]# pwd
  2. /usr/local/mysoft/tomcat8.5/bin
  3. [root@localhost bin]# ./startup.sh
  4. Tomcat started.

3、访问测试

  1. http://127.0.0.1:8080/ OK了

三、MySQL5.7 安装

1、卸载原系统中的mariadb

  1. [root@localhost /]# rpm -qa|grep mariadb
  2. mariadb-libs-5.5.56-2.el7.x86_64
  3. [root@localhost /]# rpm -e --nodeps mariadb-libs
  4. [root@localhost /]# rpm -qa|grep mariadb

2、获取官方地址

19774577d2dbc593b9808a6ac68160d50b0.jpg
b81960e539a39652743b2a2daf24eba69c9.jpg

  1. 地址:https://dev.mysql.com/downloads/repo/yum/
  2. https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

3、Yum源安装

  1. wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
  2. [root@localhost /]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
  3. [root@localhost /]# yum repolist all|grep mysql
  4. mysql57-community/x86_64 MySQL 5.7 Community Server disabled
  5. mysql80-community/x86_64 MySQL 8.0 Community Server enabled: 113
  6. mysql80-community-source MySQL 8.0 Community Server - disabled
  7. ……..

yum源中默认启用的安装包版本为MySQL8.0,这里切换为5.7,执行以下命令;

  1. [root@localhost /]# yum-config-manager --disable mysql80-community
  2. [root@localhost /]# yum-config-manager --enable mysql57-community

70a49504562af5dfc4b1090f5ae26518b94.jpg

4、MySQL 安装启动

  1. [root@localhost /]# yum install mysql-community-server
  2. # 需要安装依赖提示,选择y
  3. Total download size: 192 M
  4. Installed size: 865 M
  5. Is this ok [y/d/N]: y

查看版本

  1. [root@localhost /]# mysql -V
  2. mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper

启动查看状态

  1. [root@localhost /]# systemctl start mysqld.service
  2. [root@localhost /]# systemctl status mysqld.service
  3. mysqld.service - MySQL Server
  4. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
  5. Active: active (running) since Tue 2019-05-14 17:26:32 CST; 31s ago

为root账户生成临时密码

  1. [root@localhost /]# grep 'temporary password' /var/log/mysqld.log
  2. 2019-05-14T09:26:28.657250Z 1 [Note] A temporary password is generated for root@localhost: !Bh(GT.od9L;

设置root用户密码

  1. # 这里防止出现密码策略,强度不够的问题
  2. mysql> set global validate_password_policy=LOW;
  3. mysql> alter user 'root'@'localhost' identified by 'husky123456';

这样,Java的基础环境就搭建完毕了!