Current location - Quotes Website - Team slogan - How to install tomcat server under linux
How to install tomcat server under linux
Methods/steps

1

First of all, let's download tomcat. Because I installed jdk 1.7 before, I downloaded the corresponding tomcat 7 here. Click the download link to open the following page.

2

In the page opened above, open the compiled tar.gz package and explain it, as shown below;

three

Right-click the link of tar.gz package and select "Copy Link Address" from the pop-up menu (most browsers have similar functions);

four

through

After the above operations, we got the download address of tomcat. Let's use the terminal to download tomcat: enter the command: wget.

five

under

After loading, let's unpack and enter the command: tar-zxvf Apache-Tomcat-7.0.61.tar.gz-c/usr/local/

Unzip the package /usr/local/ directory, and then enter the command: mv/usr/local/Apache-Tomcat-7.0.61.

/usr/local/tomcat7 Rename the newly extracted tomcat directory to apache-tomcat-7.0.6 1 and call it tomcat7.

six

lose

Enter the command: /usr/local/tomcat7 to switch to.

Under the /usr/local/tomcat7 directory, let's start the tomcat service. Just go to the bin directory under tomcat and find sartup.sh

The service has started. To start the service, let's enter the command:. /bin/startup.sh. After entering enter, you will see the status information of service startup.

seven

The default startup port number of tomcat is: 8080. When you enter http://localhost:8080/ in the linux system of the virtual machine, you will find that the access is successful.

eight

but

When you use the ip of linux for external access, you will find that it fails, because by default, the firewall of linux is open, and only a few special ports can be accessed externally after the system is installed.

Q: If the post-installed software needs to be accessed through an external port, there are two solutions: 1. Use the command: sevice iptables stop.

Stop the firewall service, but when you start the linux system, the firewall will restart; 2. The most basic solution is to add a port number rule that requires external access to firewall rules, as shown below.

First enter the command:/sbin/iptables-iinput-ptcp-dport8080-jaccept.

Edit the firewall rules file, and then enter the command: /etc/rc.d/init.d/iptables to save to the iptables file.

Finally, enter the command: service iptables restart to restart the firewall service and make the newly added rules take effect.

nine

After the configuration is completed and takes effect, you can use the command: /etc/init.d/iptables status to check whether the current 8080 port is added successfully;

10

After adding firewall rules, you can use an external browser to access tomcat in the format of http:/192.168.1.64: 8080/,and you will find it successful.