Native environment :CentOS release 6.10
Tomcat edition :Tomcat7

* Tomcat Download for
The desktop version can be accessed directly with a browser Tomcat Download it from the official website , It can also be used wget <url> Download .
wget
http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.90/bin/apache-tomcat-7.0.73.tar.gz
* Tomcat Installation of
use tar -zxvf apache-tomcat-7.0.73.tar.gz Unzip to the current path . I usually put the installed software in the /usr In the table of contents :mv
apache-tomcat-7.0.73/ /usr/local/tomcat7
* Environment variable configuration
use vim /etc/profile Open profile , Add on the last side export CATALINA_HOME=/usr/local/tomcat7
, However, it seems that the effect of this environment variable is the same .
* start-up Tomcat
Want to start successfully Tomcat It needs to be installed first jdk.
Enter Tomcat Of bin Under the table of contents , function startup.sh <http://startup.sh>
cd /usr/local/tomcat7/bin
./startup.sh
Operation results [[email protected] bin]# ./startup.sh Using CATALINA_BASE:
/usr/local/tomcat7 Using CATALINA_HOME: /usr/local/tomcat7 Using
CATALINA_TMPDIR: /usr/local/tomcat7/temp Using JRE_HOME: /usr/java/jdk1.7.0_80
Using CLASSPATH:
/usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started. stop it tomcat, The following errors may occur [[email protected] bin]#
./shutdown.sh Using CATALINA_BASE: /usr/local/tomcat7 Using CATALINA_HOME:
/usr/local/tomcat7 Using CATALINA_TMPDIR: /usr/local/tomcat7/temp Using
JRE_HOME: /usr/java/jdk1.7.0_80 Using CLASSPATH:
/usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar Sep
19, 2018 3:55:30 PM org.apache.catalina.startup.Catalina stopServer SEVERE:
Could not contact localhost:8015. Tomcat may not be running. Sep 19, 2018
3:55:30 PM org.apache.catalina.startup.Catalina stopServer SEVERE:
Catalina.stop: java.net.ConnectException: Connection refused at
java.net.PlainSocketImpl.socketConnect(Native Method) ... ... ... at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430) Access to information on the Internet , Find a solution , stay
/usr/java/jdk1.7.0_80/jre/lib/security Directory java.security file , find
securerandom.source=file:/dev/urandom This line configuration , Change it to
securerandom.source=file:/dev/./urandom Then stop successfully Tomcat service .
* test result
Local test . If it's a desktop version , open firefox, input localhost:8080, Welcome page appears successfully , Then the configuration is successful

Other computer access input ip:8080, It may appear 404 error , Because the firewall limits port access , So we need to open it in the firewall configuration 8080 port .
Open firewall profile vim /etc/sysconfig/iptables
Add a line to it -A INPUT -m state --state NEW -m tcp -p TCP --dport 8080 -j ACCEPT
You can open it 8080 port
esc Post input :wq Exit editing , input service iptables restart Restart the service , Enter again ip:8080 You can access it successfully
iptables Command only for centos6 edition ,centos7 use firewalld Instead of iptables, But it can also be used yum -y install
iptables install iptables, Reuse systemctl stop firewalld close firewalld Service is OK
* If you are using alicloud server , Be sure to create new rules in the firewall of alicloud console , Be sure to create new rules in the firewall of alicloud console , Be sure to create new rules in the firewall of alicloud console .

Not good at learning , If there is any mistake, please point it out