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
l download JDK
l upload JDK
With Xftp new / usr / local / java / directory , and upload it to the directory .
l extract the JDK
In Xftp in extracting JDK
l 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
l the / etc / profile to take effect
# source /etc/profile
l 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
l Download MySQL
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
l install MySQL
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server
l opened MySQL services
systemctl enable mysqld
l Check MySQL version
rpm -aq | grep -i mysql
l Start MySQL service
systemctl restart mysqld
l see MySQL initial password
grep 'A temporary password' /var/log/mysqld.log
l Change MySQL password
mysqladmin -u root -p ' old password ' password ' new password '
Note: The password can not be too simple, otherwise change unsuccessful.
l 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
l 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