Configure tomcat in a Linux Virtual Machine and tomcat in a linux Virtual Machine
1. Download tomcat from the Apache official website.
Http://tomcat.apache.org/download-80.cgi
The blogger I downloaded is tomcat8.
The jdk of the blogger is 1.8.
If your jdk is 1.7 or less, download tomcat6 or tomcat7.
2. Upload the downloaded tomcat file to the Linux virtual machine.
3. Go to the tomcat directory and decompress the compressed package.
My tomcat is in the/software Directory
Decompress the command: tar xzvf apache-tomcat-8.5.
After decompression, an extra file will be generated.
Enter the command: ll
View directory
Next, we can delete our compressed package.
Enter the command: rm-f apache-tomcat-8.5.9.tar.gz
4. Go to the bin directory under tomcat to start tomcat.
Run the following command: cd apache-tomcat-8.5.9/bin.
Start tomcat command:./startup. sh
Check all processes to see if tomcat is started
Enter the command: ps-ef
There are too many processes. If viewing is inconvenient, we can create a text file to save all processes.
Enter the command: ps-ef>/software/ps.txt
Filter the processes we want. For example, I want to filter out processes with java.
Enter the command: ps-ef | grep java
When we need to disable tomcat
Close tomcat command:./shutdown. sh
5. When the server checks that tomcat is disconnected, We need to install a Telnet
Enter the command: yum install telnet
Make sure your network is connected
Enter y to agree to install
Installation Complete
To test tomcat connection in a Linux virtual machine, you must first start tomcat first.
Enter the command: telnet IP address 8080
The following figure shows the tomcat test.
This is the case when Tomcat fails to be tested.
How to view your own port
Open the server File to view
6. Check whether the client can communicate with tomcat. Install a Telnet client.
The IP address cannot be accessed in the Windows system.
Enter the command: ping the IP address
In the window system, use the Telnet command to debug tomcat connection for Linux virtual machines
Enter the command: telnet IP address 8080
The connection failed because we have a firewall in Linux.
In this case, we can disable the firewall of the Linux virtual machine.
Run systemctl stop firewalld. service.
The Window system is testing whether it can be connected.
OK. We can connect to it.
7. Write a JSP page for debugging.
The default Tomcat directory is webapps.
Let's take a look.
There are five files
We deleted unnecessary files except ROOT. The ROOT file is the default project file of tomcat.
For convenience, I deleted other files directly on winscp, leaving only one ROOT file
When we access the window system on a page, it will jump to the ROOT project by default. The home page of this project is the apache website.
Next, upload the JSP page we just wrote to the ROOT file.
Open test. jsp on the webpage.
We can see whether the console outputs
View tomcat console and track log files
First, go to the logs file under the tomcat File
Enter the command: tail-f catalina. out
8. Summary
We can see that abc is output in the background.
In this way, we can configure tomcat in the Linux virtual machine.
Reprinted please indicate the source: http://www.cnblogs.com/qq1272850043/p/6252884.html