Before installing tomcat must first install and configure Java JDK corresponding environment
A. Environmental preparation
JDK版本:12.0.1
II. Check the JDK version of the system
1. Enter the command: java -version
显示
2. Check the installation package JDK
输入命令:rpm -qa | grep java
显示
3. Uninstall openjdk
或者使用命令:yum remove *openjdk*
III. Install the new JDK
1. Create a directory java jdk installation directory under / usr / directory
mkdir /usr/local/java
2. Use wget to download the installation package
wget https://download.oracle.com/otn-pub/java/jdk/12.0.1
+12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_
linux-x64_bin.tar.gz
会发现报错,是因为在Oracle官网上下载jdk,需要点击
accept licence的才能下载,所以要输下面的命令:
wget --no-check-certificate --no-cookies --header
"Cookie:oraclelicense=accept-securebackup-cookie"
https://download.oracle.com/otn-pub/java/jdk/12.0.1+
12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_
linux-x64_bin.tar.gz
注意 : 记住需要加上:--no-check-certificate --no-cookies
--header "Cookie: oraclelicense=accept-securebackup
-cookie" 这段是为了避开用户验证用的
3. Extract the installation package
tar -zxvf jdk-12.0.1_linux-x64_bin.tar.gz
4. Configure Environment Variables
vim /etc/profle
5. Execute the Profile file
source /etc/profile
6. Check the newly installed JDK
java -version
显示
-
Tomcat installation
A. Download the Tomcat installation package
-
Into the official website
2. Download
After good download, upload virtual machines to / usr / local
3. Extract Tomcat
tar -zxvf apache-tomcat-9.0.21.tar.gz
4. Modify the file named tomcat9
mv apache-tomcat-9.0.21 tomcat9
5. Start Tomcat
cd tomcat9/bin
./startup.sh
6. Set up a firewall
防火墙开放8080端口,增加到防火墙配置中
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
7. Restart
./startup.sh
8.IP + 8080 port