Linux system is built to tomcat environment configuration and then to web project war package deployment

Deploy a WEB test project and record the process from system installation to environment construction to project deployment. The specific steps are as follows:

1. Install a virtual machine

Install the Oracle VM virtual machine, download the VirtualBox-6.1.34a-150636-Win.exe installation package, and follow the prompts to install the virtual machine.

Two, create a linux system

 After the virtual machine is installed, create a Linux operating system and download the image file, which can be downloaded from forums or Huawei open source images.

Download the centos7-x86 image package (download according to the actual needs of the production environment), and follow the prompts to complete the installation.


3. WinSCP tool preparation

1. Prepare the tools for operating linux. Here we use winScp to perform file visualization mobile operations. You can also follow Xshell and other tools according to your habits.
2. Use the ifconfig command to query the IP address.

 3. Log in to the Linux system directly with the root user, and winScp also directly uses the root user to log in, and log in according to the queried IP address. The password is the password you just customized.

Fourth, configure the jdk environment

 General steps ==> First, uninstall the jdk that comes with the system. Secondly, log in to the Oracle website, download jdk1.7, and add the installation package. Again, unzip the tarball and configure environment variables. Finally, test it out.

1. Uninstall the openjdk that comes with the system, refer to: How to delete the built-in OpenJDK on Linux_Turn X7's Blog-CSDN Blog_Delete openjdk

2. Download jdk1.7, connect to linux with winScp, create a java folder in the usr directory, and then put the installation package copy in the java folder.

 3. Log in to the Linux system, enter the directory /usr/java where the jdk compressed package is located, and execute the command tar xvf jdk7u79linuxx64.tar.gz.

4. Configure environment variables, open the etc/profile file directly through winScp, and add these four lines at the bottom of the file.

export JAVA_HOME=/usr/java/jdk1.7.0_79                                                                              export JAVA_HOME=/usr/java/jdk1.7.0_79/jar
export PATH=$PATH:$JAVA_HOME/bin  
export CLASSPATH=.:$JAVA_HOME/lib

 5. Test

First refresh the profile file through source /etc/profile,
and then check the jdk version through java -version, as shown in the figure for the corresponding version, indicating that the configuration is successful.

Five, configure the tomcat server

  1. Create a tomcat directory under the /usr folder, and copy the downloaded apache-tomcat-8.5.86.tar.gz package to the folder.

 2. Log in to the Linux system and execute the command tar vxf apache-tomcat-8.5.86.tar.gz to decompress the tomcat package.

 3. Configure environment variables and open the /etc/profile file.

Modify the configuration as follows:

export CATALINA_HOME=/usr/tomcat/apache-tomcat-8.5.86  
export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin  
export CLASSPATH=.:$JAVA_HOME/lib:$CATALINA_HOME/lib

 4. Test.

Execute the command source /etc/profile to refresh the profile file, and then execute the startup.sh command to start tomcat

 5. Open the browser. Enter http://localhost:8080/, such as: http://192.168.56.102:8080/

If it cannot be accessed, it may be the reason of the firewall.

Through the service iptables status check, it is found that the firewall is turned on, so the firewall is temporarily closed through service iptables stop (or it can be closed through chkconfig iptables off, but it needs to be restarted after setting).
 

The configuration is successful as follows.

6. Deploy WEB test project

1. Copy the war package to the /usr/tomcat/apache-tomcat-8.5.86/webapps folder.

 

 2. Enter the Linux system, under the bin directory of tomcat, execute startup.sh to start tomcat. Started successfully as follows.

3. Open the browser, enter http://localhost:8080/project name/, http://192.168.56.102:8080/helloworld/ The deployment of the following webpage is completed.

Guess you like

Origin blog.csdn.net/huangtao_1995/article/details/129263535