Linux creates a Java environment, and configures it to access Tomcat’s static resources

1. Install the JDK and set up the Java environment

1. Check your current Linux installation with the JDK command: java version
If the above prompts are not installed or the installation fails, you need to check the installation and installation

2. Oracle official website Download the JDK
Official website address:

3. After the successful download, the compressed package is sent to the specified server directory through the file transmitter

It is usually installed in the USR / Local directory. In this directory, create a folder to store the zip package you want to install. The file you created is installed here

4. To allow the installation, the command: chmod 777 + filename I have chmod 777 Instant
Electronic translation:

  • 0: No permissions, index used
  • 4: Read permissions, use W to apply
  • 5: Read and execute permissions, use RX to indicate
  • 6: Read and write permissions, use RW to indicate
  • 7: Read, write and execute permissions, and define RWX

Note: When the file permissions are not enough

5. Enter the installation folder. Use TAR -ZXVF + decompress package name command to decompress the compressed file and pass it in
after decompression

6. Set up the JDK environment

edit etc file/profile adds the environment variable information at the end of the file

export JAVA_HOME=/usr/local/install/jdk1.8.0_221 #fill на пути декомпрессии JDK
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

7. Add tasty input source /etc/reset profile

8. Type java -Veering to see the installation status.

Second, configure Tomcat

1. Enter the Apache official website to download the Tomcat TAR package
The official website address is

2. Use the command after downloading
tar-xzvf apache-tomcat-xxxx.tar.gz decompression
I unzipped to the installer folder created above

3. Change the ETC/Profile file in the previous step, and set the Tomcat environment variable

export TOMCAT_HOME=/usr/local/install/apache-tomcat-8.5.43
export CATALINA_HOME=/usr/local/install/apache-tomcat-8.5.43

Here is an additional environment variable that configures the JRE

4. Once the configuration is complete, enter the Tomcat directory to run the ./ command to start Tomcat

After prompting this step, type PS -EF | grep java to see if there is a java process for the java process

Show successful next boot, try to use port IP+8080 to access it
There are two holes here:
1. Firewall
2. If the firewall is OK, check the server configuration information

5. Visit the success page

Third, after success, perform the static allocation related to resources

1. Edit the Server.xml file in the Conf Of Tomcat folder
Look for the host tag

Add contextual information to the label you’re from
Path attribute: As a context for accessing server resources, you need to add a prefix at the time of access
Docbace attribute: resource storage location (PS: resources stored in the WebApp directory. Here I have to create an IMG folder in the WebApp directory to store file resources.

2. After completing the configuration, save the resources to a folder and access it.

Leave a Comment