First, JDK installation

JDK (Java Development Kit), literally translated as a Java Development tool. The way to think about it is that Jdk is Java, and to write Java we have to have Java in the first place, right? So the first step is to download the JDK from the official website and install it on your computer.

1. Use Yum

Install the jdk1.8 command

Yum install - y Java - 1.8.0 comes with - its - devel. X86_64Copy the code

2. Use Java-version tests

Check whether the installation is successful

Here’s a little bit more information

What is the difference between the JRE and the JDK

JRE, as the name implies, is a Java runtime environment, containing the Java virtual machine, Java basic class library. Java is the software environment that programs written in the Java language need to run. It is provided to users who want to run Java programs. The JDK, as its name implies, is the Java development kit, which programmers use the Java language to write Java programs. It is provided to programmers. JDK includes JRE, but also contains the compiler javac compilation Java source code, but also contains a lot of Java program debugging and analysis tools: JConsole, JVisualVM and other tools, but also contains the Java program to write required documents and demo examples. If you need to run Java programs, just install the JRE. If you need to write Java programs, you need to install the JDK.

Simply put, JRE can support the running of Java programs, including THE JVM virtual machine (java.exe, etc.) and basic class libraries (rt.jar, etc.). JDK can support the development of Java programs. It includes compiler (javac.exe), development tools (javadoc.exe, jar.exe, Keytool.exe, jconsole.exe) and more class libraries (such as tools.jar).

Two, Tomcat installation

Tomcat is the Web container. When conducting web project development, HTTP protocol is often needed, which is based on request and response. For example, if you enter a line of content in Baidu to search, how does Baidu server handle this request? It needs to create servlets to handle it, and servlets are really Java programs, just Java programs on the server side, and servlets intercept your requests through configuration files, process them, and show you the interface. So how are servlets created? This is where Tomcat comes in. That’s what Tomcat is all about!

Let’s install Tomacat

The first step is to have a Java environment on your computer, which means you have the JDK installed

1. Download the Tomcat package for Linux from the Tomcat official website

2. Use Xftp or other visual tools to upload the downloaded Tomcat package to the usr/local directory of the server

3. Run the tar -zxvf apache-tomcat-8.5.35 command to decompress the Tomcat package

4. Go to the bin directory of tomcat and run the./startup.sh command to start tomcat

5, inputYou can visit the tomcat home page at http://127.0.0.1:8080

Note here: use Ali cloud server to configure the open port, find the corresponding place to add it, or access failure

Mysql > install Mysql

MySQL is the most popular relational database management system

1. Install using compressed packages

1.1, download package dev.mysql.com/get/Downloa…

1.2. Use Xftp to upload the downloaded Tomcat package to the usr/local directory of the server

RPM -bundle.tar decompress the tmysql package using tar -zxvf mysql-8.0.15-1.el7.x86_64. RPM -bundle.tar

1.4, use the RPM – qa | grep mariadb command to see mariadb installation package

Uninstall Mariadb using RPM -e mariadb-libs-5.5.60-1.el7_5.x86_64 –nodeps

1.6. Run the RPM -ivh mysql-community-common-8.0.15-1.el7.x86_64. RPM –nodeps –force command to install common

1.7. Run the preceding commands to install liBS, Client, and Server in sequence

Note: If the following error occurs during server installation

Perform yum install libaio – y statement, then perform the installation server again RPM – qa | grep mysql statement view has been installed

Mysqld –initialize; chown -r mysql:mysql /var/lib/mysql

1.9, systemctl start mysqld

1.10, to check the initial password cat/var/log/mysqld log | grep password

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’

1.12. Execute the following statements respectively to authorize remote connection

use mysql; ALTER USER 'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; update user set host='%' where user = 'root'; flush privileges;Copy the code

2. Use online installation

2.1. Enter RPM -uvh dev.mysql.com/get/mysql-c…

Yum -y install mysql-community-server

2.3, start mysqlsystemctl start mysql

Create user and log in to mysqlmysqladmin -uroot password 123456

2.5. Authorize remote access

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
 flush privileges;
Copy the code

3, test start mysql server

[root@localhost /]# /usr/local/mysql/support-files/mysql.server start
Copy the code

If the following information is displayed, the database is successfully installed and started.

Abnormal situation

1. If the following information is displayed

Starting MySQL... ERROR! The server quit without updating PID file
Copy the code

Check whether mysql and mysqld services exist. If yes, end the process and run the restart command again

# query service ps - ef | grep mysql | grep -v grep ps - ef | grep mysqld | grep -v grep # end process kill 9 PID # start the service /usr/local/mysql/support-files/mysql.server startCopy the code

2. Add a soft connection and restart the mysql service

[root@localhost /]#  ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 
[root@localhost /]#  ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
[root@localhost /]#  service mysql restart
Copy the code

3. Log in to mysql and change the password (the password is the temporary password generated in Step 5).

[root@localhost /]# mysql -u root -p Enter password: mysql>set password for root@localhost = password('yourpass'); Note: When entering the password, there will be no display after Enter Password. In fact, you have entered the password successfully. After entering the password, you can directly press Enter. Mysql -u root -p mysql -u root -pCopy the code

4. Open remote connections

mysql>use mysql;
msyql>update user set user.Host='%' where user.User='root';
mysql>flush privileges;
Copy the code

5. Set automatic startup upon startup

1. Copy the service file to init.d. Mysql [root@localhost /]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld [root@localhost /]# chmod +x /etc/init.d/mysqld [root@localhost /]# chkconfig --listCopy the code

Summary: Problems encountered in installing mysql in Linux

Check whether mysql has been installed

Delete all mysql folders if yes

Check whether the mysql directory is cleared:

Clean it up, and get back to installation