Mac OS configuration Tomcat server tutorial

Tomcat server is a free and open source web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and occasions where there are not many concurrent access users. It is the first choice for developing and debugging JSP programs. The author is learning Java Web recently, and the Tomcat server is a must-learn part.

1. Download and install Tomcat

1. Download

First, open the Tomcat official website: https://tomcat.apache.org , select the version you need under the Download column, here select the latest Tomcat 10.
insert image description here
Then select the code package, here select the zip package to download.
insert image description here

2. Install

After downloading, decompress it, and then copy the decompressed folder to the location you need. It is recommended to copy it to the Library directory under the user name directory or create a new directory for storage. I create a new Environment directory and copy apache-tomcat-10.0.27 The folder is copied here. At this time, the path of the folder is /Users/(Mac user name)/Environment/apache-tomcat-10.0.27.
insert image description here

2. Environment configuration

Click on the launch pad, enter the following command, find the terminal and enter the bin directory of Tomcat

% cd /Users/(Mac用户名)/Environment/apache-tomcat-10.0.27/bin

Then enter the command ls to see the file structure in the bin directory:

insert image description here

1. Start Tomcat

Run startup.sh in the bin directory to start Tomcat

% ./startup.sh

It is found that the prompt Permission denied (denied access), and then use the permission management command chmod to modify the execution permission of the .sh file

% chmod u+x *.sh

Run startup.sh again, and find that Tomcat started is displayed, and Tomcat is successfully started.
insert image description here
Open the Safari browser, enter http://localhost:8080 in the address bar, and you can see the Tomcat prompt page.
insert image description here

2. Close Tomcat

Run the shutdown command in the bin directory to stop the server.

% ./shutdown.sh

insert image description here
After the prompt as shown in the figure appears, it means that the Tomcat server has stopped running. Go back to the Safari browser to refresh the port 8080 of localhost, and find that the prompt page has disappeared.
insert image description here

3. View Tomcat version information

Run version.sh in the bin directory to view the relevant version information of Tomcat.

% ./version.sh

insert image description here

3. Related issues

1. Both Mac OS and Linux systems are based on Unix, and the two terminals share many common commands.
2.chmod is a permission management command in Linux, and its full English name is "change the permissions mode of a file". Its syntax is
chmod[{ugoa}{±=}{rwx}][file or directory]

uncle ±= rwx
u: owner +: increase permissions r: Read permission
g: Belonging group -: Reduce permissions w: Write permission
o: others =: grant the given permission, cancel all other permissions x: eXecute execution permission
a: everyone

Therefore, chmod u+x *.sh means to increase the execution permission to the owners of all sh files in the current directory.

Guess you like

Origin blog.csdn.net/weixin_43805744/article/details/128003923