1. Download and install Tomcat
-
Select the Tomcat version you need to use
-
Download the specified version compressed package
tar.gz
and select the file as shown below
-
Unzip the Tomcat compressed package file
-
Rename the decompressed package to Tomcat (to facilitate subsequent file operations, you can also omit this step) and copy it to the
/Library
(resource library) directory
2. Tomcat use
Terminal
Open the directory in Tomcat through the terminalbin
, and the operation command is as follows
cd ~/Library/Tomcat/bin
- Authorize the use
bin
of all operations in the Tomcat directory. The operation commands are as follows
sudo chmod 755 *.sh
After pressing Enter, you need to enter the administrator password
- Start Tomcat, the operation command is as follows
sudo sh ./startup.sh
You can see the terminal displayTomcat started.
-
Open the browser and visit
localhost:8080
. If the page is as follows, it means that Tomcat has been started .
-
Close Tomcat, the operation command is as follows ( first switch the directory in Tomcat
bin
)
cd ~/Library/Tomcat/bin
sh ./shutdown.sh