1. Install the java environment:
Visit the orcal official website to download the jdk rpm package:
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
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
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
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
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
Now tomcat has been installed successfully, visit for testing:
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!