Linux system: install Jdk8, Tomcat8, MySQL 5.7 environment under centos7

Keywords: Linux MySQL RPM yum MariaDB

1. JDK1.8 Environment Construction

1. Upload files to decompress

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

2. Check the environment. Installed and deleted

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

3. Configuring environment variables

[root@localhost /]# vim /etc/profile
# Add shit+g at the end of the file and jump to the end of the file
# JAVA_HOME
export JAVA_HOME=/usr/local/mysoft/jdk1.8
export PATH=$PATH:$JAVA_HOME/bin

4. Successful Installation

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

II. TOMCAT8 Installation

1. Upload installation package

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

2. Start up services

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

3. Access Testing

http://127.0.0.1:8080/OK

3. MySQL 5.7 Installation

1. Unloading mariadb in the original system

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

2. Obtain official address

Address: https://dev.mysql.com/downloads/repo/yum/
https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

3. Yum Source Installation

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

The default version of installation package enabled in yum source is MySQL 8.0, where switch to 5.7, execute the following commands;

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

4. MySQL Installation Start

[root@localhost /]# yum install mysql-community-server
# To install dependency prompts, select y
Total download size: 192 M
Installed size: 865 M
Is this ok [y/d/N]: y

View version

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

Start viewing status

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

Generate temporary passwords for root accounts

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

Setting the root user password

# This prevents password policy from being too strong.
mysql> set global validate_password_policy=LOW;
mysql> alter user 'root'@'localhost' identified by 'husky123456';

In this way, the basic environment of Java is finished!

4. Source code address

GitHub Address: Know a smile
https://github.com/cicadasmile
 Code Yun Address: Know a smile
https://gitee.com/cicadasmile


Posted by onlyican on Thu, 10 Oct 2019 14:25:38 -0700