Tomcat is a free open source web application server, is characterized by advanced technology, performance, stability, and free. So become more popular web application servers, many web applications such as games, are set up in the tomcat in.
First, download tmocat
Official website address: https://tomcat.apache.org/download-90.cgi
Second, using ftp upload tools to the Linux system
In the Linux system / usr / local directory, create a tomcat folder ( mkdir tomcat )
Use ftp upload apache-tomcat-9.0.21.tar.gz file to / usr / local / tomcat directory
Third, unzip the file
Into the tomcat folder, extract the apache-tomcat-9.0.21.tar.gz package
tar zxvf apache-tomcat-9021targz
Fourth, configure the environment variables
1 , see the Tomcat default 8080 if the port is occupied
Execute the command: netstat-APN | grep 8080 --- execute the command did not respond it means not occupied
2. configuration environment variable : vi / etc / Profile
The following two lines of code to copy and paste the profile file at the bottom
export CATALINA_BASE=/usr/local/tomcat/apache-tomcat-9.0.21 export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.21
3. Verify that the installation was successful
# Echo $ CATALINA_HOME - displays the path configuration instructions after the successful implementation
# Echo $ CATALINA_BASE - displays the path configuration instructions after the successful implementation
4 , into the /usr/local/tomcat/apache-tomcat-9.0.21/bin directory
Execution: ./startup.sh command ( ./ is liunx execution shell command scripts)
5 , added in the firewall 8080 port
Enter the command: vi / etc / sysconfig / iptables
Note: CentOS7, the default is no iptables, the firewall but use a firewall. This article will shield the firewall, use iptables
1 , stop the service and shield firewalld systemctl stop firewalld - stop systemctl mask firewalld - shield
2 mounted iptables- -Service Packages yum the install iptables- Services
. 3 , the service enabled at boot iptables enable iptables systemctl
4 , start the iptables service Start iptables systemctl
5 , save the firewall rules service iptables save
Locate the following line
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT In this line of code following a new line
Input:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
Save and exit: esc: WQ!
6 , reboot the firewall
service iptables restart
Fifth, to see if the installation was successful
Back winodws , enter the virtual machine IP: 8080 (ip address enter the ifconfig command in Linux systems)
Display tomcat home page description tomcat installation is successful