Install jdk1.8 (rpm version) under Linux system

1. Upload jdk1.8rpm

1.1 Graphical interface upload

I uploaded it through the WinSCP graphical interface, or I can use the command upload to upload
the installed things to the /home/environment directory

Insert picture description here

1.2 View uploaded files

Use the cd command to switch to the /home directory to
see what files are in the directory

ls
Insert picture description here

2. Install JDK1.8 (rpm version)

2.1 jdk1.8rpm download

jdk1.8rpm download address: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2.2 Uninstall if openjdk is installed

2.2.1 First check if there is openjdk

[[email protected] ~]# java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[[email protected] ~]# rpm -qa|grep jdk
copy-jdk-configs-3.3-10.el7_5.noarch
java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64

2.2.2 Forced deletion

[[email protected] ~]# rpm -e --nodeps copy-jdk-configs-3.3-10.el7_5.noarch
[[email protected] ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64
[[email protected] ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64
[[email protected] ~]# java -version
-bash: /usr/bin/java: No such file or directory

2.3 Install JDK

Installation command: rpm -ivh jdk name

[[email protected] environment]# rpm -ivh jdk-8u60-linux-x64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_60-2000:1.8.0_60-fcs    ################################# [100%]
Unpacking JAR files...
        tools.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...
        jfxrt.jar...

2.4 Configure environment variables

2.4.1 View the directory where jdk is installed

[[email protected] local]# cd /usr
[[email protected] usr]# ls
bin  etc  games  include  java  lib  lib64  libexec  local  sbin  share  src  tmp
[[email protected] usr]# cd java
[[email protected] java]# ls
default  jdk1.8.0_60  latest

2.4.2 Configuration variables

Use the command to enter: vim /etc/profile

JAVA_HOME=/usr/java/jdk1.8.0_60
CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH CLASSPATH JAVA_HOME

2.5 Configure environment variables to take effect

source /etc/profile

2.6 Testing

Test command: java -version

[[email protected] environment]# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

3. Simple case of deploying SpringBoot in Linux

3.1 Package the project

We casually find the case written before, without the SpirngBoot project with a database, package it

Insert picture description here

3.2 Local test

Insert picture description here


Insert picture description here

3.3 upload jar package

Insert picture description here

3.4 Check if the port is open

# 查看firewall服务状态
systemctl status firewalld

# 开启、重启、关闭、firewalld.service服务
# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop

# 查看防火墙规则
firewall-cmd --list-all    # 查看全部信息
firewall-cmd --list-ports  # 只看端口信息

# 开启端口
开端口命令:firewall-cmd --zone=public --add-port=80/tcp --permanent
重启防火墙:systemctl restart firewalld.service

命令含义:
--zone #作用域
--add-port=80/tcp  #添加端口,格式为:端口/通讯协议
--permanent   #永久生效,没有此参数重启后失效
[[email protected] environment]# firewall-cmd --list-ports

[[email protected] environment]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

[[email protected] environment]# firewall-cmd --zone=public --add-port=8080/tcp
success
[[email protected] environment]# firewall-cmd --list-ports
8080/tcp

3.5 Deploy the project

Insert picture description here
Insert picture description here


Content reference:
https://www.bilibili.com/video/BV187411y7hF
is for learning only!