Home > Java > javaTutorial > How to configure java environment and install tomcat in Centos

How to configure java environment and install tomcat in Centos

WBOY
Release: 2023-04-30 11:07:06
forward
1466 people have browsed it

1. Install the java environment:

Visit the orcal official website to download the jdk rpm package:

How to configure java environment and install tomcat in Centos

Execute after the download is complete:rpm -ivh jdk-8u161-linux-x64.rpm Install, it will be installed in the /usr/java directory by default

How to configure java environment and install tomcat in Centos

After the installation is complete, modify /etc/profile file, add java environment variables:

export java_home=/usr/java/jdk1.8.0_161/export classpath=.:$java_home/jre/lib/rt.jar:$ java_home/lib/dt.jar:$java_home/lib/tools.jarexport path=$path:$java_home/bin

How to configure java environment and install tomcat in Centos

After the addition is completed, execute: source / etc/profile Make the configuration effective

Execute:java -version Verify whether the configuration is successful. The following interface appears to indicate that the configuration is successful

How to configure java environment and install tomcat in Centos

2. Install tomcat

Visit the apache official website and download the tomcat source code package:

Be sure to select the source code package in binary distributions when downloading

How to configure java environment and install tomcat in Centos

After downloading, unzip it and copy the contents of the unzipped directory to /usr/local/tomcat (the /usr/local/tomcat directory needs to be created manually)

tar -xf apache-tomcat-8.5.38.tar.gz
mkdir /usr/local/tomcat8
mv apache-tomcat-8.5.38/* /usr/local/tomcat8/
cd /usr/local/tomcat8/bin
./startup.sh
Copy after login

How to configure java environment and install tomcat in Centos

Now tomcat has been installed successfully, visit for testing:

How to configure java environment and install tomcat in Centos

The above is the detailed content of How to configure java environment and install tomcat in Centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template