Spring Boot 2.X combat tutorial (21) Spring Boot installed applications

21 . Installation Spring Boot application

Except by using the Run Spring Boot application outside the Java -jar , can also Unix systems to create a fully executable applications. Fully executable jar like any other executable binaries as execution, you can also use init.d or registered systemd . This makes installation and management of common production environment Spring Boot application very easily. 

To use Maven to create a " fully executable " JAR , please use the following plug-in configuration:

<plugin>

<groupId> org.springframework.boot </ groupId>

<artifactId> spring-boot-maven-plugin </ artifactId>

<configuration>

<executable> true </ executable>

</ configuration>

</ plugin>

You can then by typing ./my-application.jar ( My-the Application  to run your application name of your workpiece). It contains jar directory as the application's working directory.

21.1 install Linux version of the JDK

download JDK

http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz

upload JDK

With Xftp new / usr / local / java / directory , and upload it to the directory .

extract the JDK

In Xftp in extracting JDK

modify configuration files

In Xftp modify / etc / profile, at the end of the file add :

export JAVA_HOME=/usr/local/java/jdk1.8.0_181

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

the / etc / profile to take effect

# source /etc/profile

Check the installation results

# java -version

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

21.2 install Linux version of MySQL

Download MySQL

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

install MySQL

yum localinstall mysql57-community-release-el7-8.noarch.rpm

yum install mysql-community-server

opened MySQL services

systemctl enable mysqld

Check MySQL version

rpm -aq | grep -i mysql

Start MySQL service

systemctl restart mysqld

see MySQL initial password

grep 'A temporary password' /var/log/mysqld.log

Change MySQL password

mysqladmin -u root -p ' old password ' password ' new password '

Note: The password can not be too simple, otherwise change unsuccessful.

Set mysql remote access

Log into MySQL : MySQL-uroot--p password

Add a user gives access to: . Grant All privileges ON * * to 'root' @ 'ip address ' identified by ' password ' with grant option; // can be ip changed %%, expressed Open All

refresh permission

flush privileges;

23.3 install Linux version of Redis

l download the package

wget http://download.redis.io/releases/redis-4.0.2.tar.gz

l extract the installation package and install

takes xzf redis-4.0.2.tar.gz

cd-repeat 4.0.2

make

make install

l Start Service

cd /root/redis-4.0.2

redis-server redis.conf

l shut down service

redis-cli -h 127.0.0.1 -p 6379 -a password

shutdown

l Remote Access

Remove /root/redis-4.0.2/redis.conf

bind 127.0.0.1

l Change Password

requirepass 123456

21.4 running applications

l command running in the background:

nohup java -jar demo-1.0.0-SNAPSHOT.jar

l View background processes:

ps aux

ps aux | grep demo-1.0.0-SNAPSHOT.jar

l kill background processes:

kill -9 pid

 

If in doubt, watch the video: https://ke.qq.com/course/428845

 

Guess you like

Origin www.cnblogs.com/daqiang123/p/11270999.html