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

How to configure java environment and install tomcat in Centos

WBOY
WBOYforward
2023-04-30 11:07:061430browse

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

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete