1. Installation of jdk
1. Upload jdk to the opt directory
2. Unzip jdk
tar -xvf jdk-8u281-linux-x64.tar.gz
3. Generally, jdk is placed in /usr/local (software installation is placed under usr)
mv jdk1.8.0_281 /usr/local/
4. Configure environment variables
Find /etc/profile for editing and modification
export JAVA_HOME=/usr/local/jdk1.8.0_281 # 设置 jdk的位置
export PATH=$PATH:$JAVA_HOME/bin # 设置环境变量
Configuration file refresh:
source /etc/profile
[root@localhost ~]# java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)
2. Tomcat installation
1. Upload tomcat to the opt directory
2. Unzip
tar -xvf apache-tomcat-9.0.53.tar.gz
3. Move to /usr/local
mv apache-tomcat-9.0.53 /usr/local
Modify name:
mv apache-tomcat-9.0.53/ tomcat
4. Go to the tomcat directory to start
进入tomcaot的bin目录
cd /usr/local/tomcat/bin 目录
./startup.sh # 执行文件启动tomcat bat启动的win sh启动linux版本
Started successfully:
View process filter tomcat
ps -aux 查看所有的进程
| 多个命令进行串联
grep tomcat 过滤tomcat
4. Access tomcat:
http://192.168.31.129:8080/ cannot be accessed
Set up the firewall:
systemctl status firewalld View the status of firewall commands
Turn off the firewall:
Command to turn off the firewall
systemctl stop firewalld;
To permanently disable the firewall:
systemctl disable firewalld;
Notice:
- Turn off the firewall while studying
- You can't close it during work, just open the specified port
5. Access tomcat