Tutorial on installing JDK Tomcat MySQL on Linux (remote access using Mac)

Tutorial on installing JDK Tomcat MySQL on Linux (remote access using Mac)

One environment

Alibaba Cloud Server: CentOS 7.4 64-bit (based on RedHat)

Local machine: macOS High Sierra

Two compression packages

JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Tomcat https://tomcat.apache.org/download-80.cgi#8.5.31

MySQL https://dev.mysql.com/downloads/mysql/

Three file transfer

Enter the SFTP command to connect -> Enter the instance login password

sftp root@public IP

Upload

put local file server path

download

Get the local path of the server file

4. Remote Access

Enter the SSH command to connect -> enter the instance login password

ssh root@public IP

5. Turn off the firewall

Turn off firewall

systemctl stop firewalld.service

Disable the firewall startup function

systemctl disable firewalld.service

Check the firewall status

firewall-cmd --state

6. Install JDK

Check whether Java is installed on the current Linux system

rpm -qa | grep java

Uninstall installed Java

rpm -e --nodeps 要卸載的軟件

Create a new directory

cd /usr/local

mkdir jdk

Unzip

cd the directory where the jdk compressed package is located

tar -xvf jdk-8u171-linux-x64.tar.gz -C /usr/local/jdk

Configure the jdk environment variables and copy the following configuration into it

vim /etc/profile

# java environmentJAVA_HOME=/usr/local/jdk/jdk1.8.0_171CLASSPATH=.:$JAVA_HOME/lib.tools.jarPATH=$JAVA_HOME/bin:$PATHexport JAVA_HOME CLASSPATH PATH

Reload the /etc/profile configuration file

source /etc/profile

7. Install Tomcat

Create a new directory

cd /usr/local

mkdir tomcat

Unzip

cd the directory where the tomcat compressed package is located

tar -xvf apache-tomcat-8.5.31.tar.gz -C /usr/local/tomcat

Enter the bin directory

cd /usr/local/tomcat/apache-tomcat-8.5.31/bin

start up

./startup.sh

closure

./shutdown.sh

8. Install MySQL

Check whether mysql is installed on the current Linux system

rpm -qa | grep mysql

Uninstall installed mysql

rpm -e --nodeps software to be uninstalled

Check whether mariadb is installed on the current Linux system

rpm -qa | grep mariadb

Uninstall installed mariadb

rpm -e --nodeps software to be uninstalled

mysql dependency

yum install libaio

Create a new directory

cd /usr/local

mkdir mysql

Unzip

cd the directory where the mysql compressed package is located

tar -xvf mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql

Install

cd /usr/local/mysql
  rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm
  rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm
  rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm
  rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm

Initialize mysql database

mysqld --initialize

View mysql password

more/var/log/mysqld.log

Modify the user and group to which the mysql database directory belongs

chown mysql:mysql /var/lib/mysql -R

Start mysql database

systemctl start mysqld.service

View the MySQL database status

systemctl status mysqld.service

Enter the Security Settings Wizard (the new version of MySQL must first change the root user's password, otherwise you will not be able to execute any commands after logging in)

mysql_secure_installation

Wizard 1 The existing password for the user account root has expired. Please set a new password

Wizard 2

Validate Password plugin can be used to test passwords and improve security. It checks the strength of passwords and allows users to set only those passwords that are secure enough. Are you willing to install the Validate Password plugin?

Wizard Three

Use existing root password

Wizard Four

By default, MySQL is installed with anonymous users, which allow anyone to log in without having to create a user account for them. This is just for testing and to make the installation go more smoothly. You should remove them before going into a production environment.

Wizard Five

Normally root should only be allowed to connect to "localhost" This ensures that someone cannot guess the root password from the network (I don't understand this either. Selecting yes or no will not allow remote access. Additional settings are required, which will be discussed below)

Wizard Six

By default MySQL provides a database called "test" that anyone can access. This is also for testing and should be removed before going into production.

Wizard Seven

Reloading the privilege tables will ensure that all changes made so far will take effect immediately

mysql starts by default

Solving the problem

java.sql.SQLException: null, message from server: "Host '113.57.183.25' is not allowed to connect to this MySQL server"

Reason: MySQL does not allow remote access

Solution -> Server input:

mysql -uroot -p;

Enter the MySQL login password

use mysql;
  update user set host = '%' where user = 'root';
  select host, user from user;
  flush privileges;
java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed

Reason: Retrieving public key is not allowed

Solution -> Code modification:

MySQL URL adds a parameter allowPublicKeyRetrieval=true

jdbc:mysql://120.79.191.83:3306/web?characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true

Navicat Premium 'caching_sha2_password' cannot be loaded: dlopen(../Frameworks/caching_sha2_password.so, 2): image not found

Reason: MySQL 8.0 changed the authentication plugin

Solution -> Server input:

mysql -uroot -p;

Enter the MySQL login password

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY ' Replace this with your own password';

Summarize

The above is the tutorial on how to install JDK Tomcat and MySQL on Linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • 2020macOS Big Sur configures the Java development environment and the JDK installation process
  • Detailed tutorial on installing and configuring Maven on Mac and configuring it in IDEA
  • Detailed method of installing JDK and IDEA on Mac M1 in 2020

<<:  Vue Element front-end application development conventional Element interface components

>>:  Detailed explanation of Linux copy and paste in VMware virtual machine

Recommend

Tutorial on installing rabbitmq using yum on centos8

Enter the /etc/yum.repos.d/ folder Create rabbitm...

Difference between MySQL update set and and

Table of contents Problem Description Cause Analy...

Detailed explanation of virtual DOM and diff algorithm in react

The role of virtual DOM First of all, we need to ...

Detailed explanation of the use of base tag in HTML

In requireJS, there is a property called baseURL....

HTML elements (tags) and their usage

a : Indicates the starting or destination positio...

vue-pdf realizes online file preview

This article example shares the specific code of ...

MySQL database Load Data multiple uses

Table of contents Multiple uses of MySQL Load Dat...

Simple tutorial on using Navicat For MySQL

recommend: Navicat for MySQL 15 Registration and ...

Detailed explanation of JavaScript's built-in objects Math and strings

Table of contents Math Objects Common properties ...

A brief discussion on the corresponding versions of node node-sass sass-loader

Table of contents The node version does not corre...

Pure CSS to achieve hover image pop-out pop-up effect example code

Implementation principle The main graphics are co...

MySQL 8.0.15 installation and configuration graphic tutorial under Win10

This article records the installation and configu...

MySQL server 5.7.20 installation and configuration method graphic tutorial

This article records the installation and configu...