1. Install Java on Linux

1.1 an overview of the

This section uses JDK 1.8.0_152 as an example

1.2 Download Address

www.oracle.com/technetwork…

1.3 Decompressing the Package and Moving it to a Specified Directory

1) unzip
tar -zxvf jdk-8u152-linux-x64.tar.gz
Copy the code
② Creating a Directory
mkdir -p /usr/local/java
Copy the code

-p: creates a subdirectory recursively

③ Move the installation package
The mv jdk1.8.0 _152 / / usr/local/Java /Copy the code
④ Set the owner
chown -R root:root /usr/local/java/
Copy the code

-r: recursive setting. That is, the owner is set for all files in a subdirectory

1.4 Configuring Environment Variables

① Configure environment variables
vi /etc/environment
Copy the code
② Add the following statement
# default has this line PATH = "/ usr/local/sbin, / usr/local/bin: / usr/sbin, / usr/bin, / sbin, / bin: / usr/games: / usr/local/games" # add export start from here JAVA_HOME = / usr/local/Java/jdk1.8.0 _152 export JRE_HOME = / usr/local/Java/jdk1.8.0 _152 / jre export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/libCopy the code

③ Configure user environment variables
vi /etc/profile
Copy the code
④ Add the following statement
If ["$PS1"]; then if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then # The file bash.bashrc already sets the default PS1. # PS1='\h:\w\$ ' if [ -f /etc/bash.bashrc ]; then . /etc/bash.bashrc fi else if [ "`id -u`" -eq 0 ]; /usr/local/ Java /jdk1.8.0_152 export =/usr/local/ JAVA_HOME=/usr/local/ Java /jdk1.8.0_152 export JRE_HOME = / usr/local/Java/jdk1.8.0 _152 / jre export CLASSPATH = $CLASSPATH: $JAVA_HOME/lib: $JAVA_HOME/jre/lib export PATH = $JAVA_HOME/bin: $JAVA_HOME/jre/bin: $PATH: $HOME/bin # here end # default has this paragraph if [-d/etc/profile. D]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fiCopy the code
⑤ Make user environment variables effective
source /etc/profile
Copy the code

1.4 Verifying the Installation

Command:

java -version
Copy the code

Expected output:

Java Version "1.8.0_152" Java(TM) SE Runtime Environment (build 1.8.0_152-B16) Java HotSpot(TM) 64-bit Server VM (build 25.152 - b16, mixed mode)Copy the code

1.5 Updating user environment variables for other users

su snzl
source /etc/profile
Copy the code

2. Install Tomcat on Linux

2.1 an overview of the

This section uses Tomcat 8.5.23 as an example

2.2 Download Address

tomcat.apache.org/

2.3 Installation Process

1) unzip
Tar ZXVF - apache tomcat - 8.5.23. Tar. GzCopy the code
② Change the directory name
Mv apache tomcat - 8.5.23 tomcatCopy the code
③ Moving directories
mv tomcat/ /usr/local/
Copy the code

2.4 Common Commands

1) start
/usr/local/tomcat/bin/startup.sh
Copy the code
(2) stop
/usr/local/tomcat/bin/shutdown.sh
Copy the code
③ Execute the script in the directory
./startup.sh
Copy the code

3. Install MySQL on Linux

3.1 Installation Process

① Update the data source
apt-get update
Copy the code
(2) install MySQL
apt-get install mysql-server
Copy the code

Note: You will be prompted to create a root password during installation. Choose a secure password and make sure you remember it because you’ll need it later. Next, we will complete the configuration of MySQL.

Note: It is possible that the latest version of MySQL does not have a password set during the installation process, which is the default password is empty.

3.2 configuration

Note: Since this is a fresh installation, you will need to run the accompanying security script. This changes some of the less secure default options, such as remote root logins and sample users. On older versions of MySQL, you had to initialize the data directory manually, but MySQL 5.7 does it automatically.

Run the security script:

mysql_secure_installation
Copy the code

You will be prompted for the root password you created in the previous step. You can press Y and then ENTER to accept the default values for all subsequent questions, but ask if you want to change the root password. You only set it up in the previous step, so you don’t need to change it now.

3.3 test

After the above installation is complete, MySQL should be running automatically. To test it, check its status.

Command:

systemctl status mysql.service
Copy the code

Expected output:

Low mysql. Service - mysql Community Server the Loaded: the Loaded (. / lib/systemd/system/mysql service; enabled; vendor preset: enabled) Active: active (running) since Tue 2017-11-21 13:04:34 CST; 3min 24s ago Main PID: 2169 (mysqld) CGroup: / system. Slice/mysql service └ ─ 2169 / usr/sbin/mysqld Nov 21 13:04:33 ubuntu systemd [1] : Starting MySQL Community Server... Nov 21 13:04:34 ubuntu systemd[1]: Started MySQL Community Server.Copy the code

Run the following command to query the MySQL version:

mysqladmin -p -u root version
Copy the code

3.4 Configuring Remote Access

[1] Modify the configuration file

vi /etc/mysql/mysql.conf.d/mysqld.cnf
Copy the code

[2] Comment out (#) :

The bind - address = 127.0.0.1Copy the code

[3] Restart MySQL

service mysql restart
Copy the code

[4] Log in to MySQL

mysql -u root -p
Copy the code

[5] Authorize the root user to allow everyone to connect

Grant all privileges on *.* to 'myUser '@' myUser' IDENTIFIED by 'myuser ';Copy the code

This is because this version of MySQL uses the Auth_socket plug-in, which does not care about and does not require passwords. Therefore, the password may be invalid.

Just change the price difference to mysql_native_password.

That’s pretty much the end of the story, and the next step is the on-demand configuration.

3.5 How to Resolve The Authentication Failure Due to weak Password

[1] View the password security level

select @@validate_password_policy;
Copy the code

[2] Set the password security level

set global validate_password_policy=0;
Copy the code

[3] Check the password length limit

select @@validate_password_length;
Copy the code

[4] Set a password length limit

set global validate_password_length=1;
Copy the code

3.6 Common Commands

1) start
service mysql start
Copy the code
(2) stop
service mysql stop
Copy the code
(3) restart
service mysql restart
Copy the code

3.7 Other Configurations

Modify the configurationmysqld.cnfThe configuration file
vi /etc/mysql/mysql.conf.d/mysqld.cnf
Copy the code
The default character set is configured

Add the following configuration to the [mysqld] node

[client]
default-character-set=utf8
Copy the code

Add the following configuration at the bottom of the [mysqld] node

default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
Copy the code
The configuration ignores database case sensitivity

Add the following configuration at the bottom of the [mysqld] node

lower-case-table-names = 1
Copy the code

The above.