我本地的Linux环境是Ubuntu,安装需要用到apt命令


Ubuntu下安装JDK

  1. 更新软件包列表
sudo apt-get update
  1. 安装JDK
sudo apt-get install openjdk-8-jdk
  1. 查看Java版本,看是否安装成功
java -version

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
  1. 出现JDK版本说明安装成功

  2. 还可以通过输入java和javac查看是否安装成功


Ubuntu下安装MySQL

1.安装MySQL

sudo apt-get install mysql-server
  1. 安装完成连接MySQL
mysql -h 127.0.0.1 -u root -p

Enter password:
输入MySQL密码就可以链接成功

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.5.5-10.1.38-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Ubuntu下安装tomcat

  1. 下载tomcat
wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.36/bin/apache-tomcat-9.0.36.zip
  1. 更改权限
chmod +x apache-tomcat-9.0.36.zip
  1. 解压压缩包
unzip apache-tomcat-9.0.36.zip

如果提示 -bash:unzip not found 是因为没有下载unzip

yum install unzip

下载完重新解压就好了

  1. 解压后就得到了tomcat包,此时对apache-tomcat-9.0.36再次更改权限
chmod a+x -R *
  1. 进入apache-tomcat-9.0.36
cd apache-tomcat-9.0.36
  1. 进入bin目录
cd bin
  1. 启动tomcat的命令 进入到apache-tomcat-9.0.36的bin目录下后,执行下面命令
sh startup.sh

这样就启动成功了