Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy tomcat in centos environment

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people have no idea about how to deploy tomcat in centos environment. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1 use docker to find centos image information

2 pull down, docker pull centos:6.8

3 start the centos container

Docker run-I-t-v / root/:/opt/tool centos:6.8 / bin/bash

Explanation of relevant parameters:

-I: means to run the container in "interactive mode"

-t: indicates that the container will enter its command line after startup

-v: indicates which local directory needs to be mounted to the container. Format:-v:

4 configure JDK and tomcat

Upload jdk and tomcat to / root

Decompress it under / opt/tool of the docker container

4.1 configure the JDK environment:

Cd to the root directory vi .bashrc

Add the following information at the end:

Export JAVA_HOME=/opt/jdk

Export PATH=$JAVA_HOME/bin:$PATH

Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Then under source. Bashrc, java-version detection

4.2 Test tomcat

/ opt/tomcat/bin/startup.sh command starts, default port 8080

Netstat-tnlp detection

5 tomcat run script

Vi / root/catstart.sh

#! / bin/bash

Source / .bashrc

Sh / opt/tomcat/bin/catalina.sh run

Add execution permission: chmod Ubunx / root/catstart.sh

To exit the container, use the exit command

6 to make a mirror image

Docker ps-a found the id of the container just now.

Save as Mirror docker commit 0b8142e556d0 docker01:5000/mytomcat:1.0

Start the container

Docker run-d-p 8088 8080-- name mytomcat docker01:5000/mytomcat:1.0 / root/catstart.sh

Browser access: docker01:8088

After reading the above, have you mastered how to deploy tomcat in centos environment? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 236

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report