Installation of tomcat, redis, nginx and other software under CentOs

      The context of this article:

              1.CentOs6.4 minimal

              2.jdk1.7.0_71

              3.Tomcat7.0.65

              4.Nginx1.8

              5.Redis3.0.5

              6.vm11

This article mainly records the summary of the problems encountered during the installation process

1. Environment configuration

       1.1 The problems that may arise in the installation of CentOs minimal can be viewed in my CentOs minimal installation notes.

       1.2 The download of jdk is downloaded by the wget command

 

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.rpm

    Install it with the following command

rpm -ivh jdk-7u71-linux-x64.rpm

    After installation, configure environment variables

     vim /etc/profile add the following configuration

    

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

     Check the installation status through java -version, and see the following information, indicating that the installation is successful

java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

 
     1.3 Installation of Tomcat

          

           I created 2 new folders under opt, tomcat1 and tomcat2. I got 2 tomcats for the tomcat cluster test later. Unzip the downloaded apache-tomcat-7.0.65.tar.gz into these two files respectively. , tar -zxvf apache-tomcat-7 .0 . 65 .tar.gz /opt/tomcat1 and then go to the bin directory of tomcat1 cd /opt/tomcat1/apache-tomcat-7.0.65/bin , through ./startup . sh start tomcat1 to test whether it can be accessed.

           Open the browser outside the virtual machine and enter the address, hit enter, and let you go. It turns out that you can't access it. Go back to putty to check the port monitoring through netstat -nltp and find that port 8080 is already listening, indicating that tomcat is started. Is it the network? No way? By pinging the IP address of the virtual machine outside, it is found that it can be pinged. I checked the Internet and said that it is the reason of the firewall. You can close the firewall, or modify the firewall configuration information and add a message to open port 8080.

Enter the configuration information through vim /etc/sysconfig/iptables , and copy the code to open port 8080 on the Internet -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j Add ACCEPT to the last line, restart the firewall service iptables restart and hit Enter, the result is an error, the error message says that there is a problem with the configuration just added, well, if you look closely, this configuration information is indeed a bit different from the above, so it is said that the online Not necessarily all correct, just copy the open port 22 above and change 22 to 8080. -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT, and then restart, ok no error was reported this time, the restart was successful. Then I went to the browser to access it again, but I still can't access it. I'm just getting tired of it. Well, let's switch to another method and directly turn off the firewall. Although it is not recommended, I don't want to toss any more, so I use service iptables stop . To turn off the firewall, this command is effective immediately, but invalid after restarting the system, not permanent, the command to permanently turn off the firewall checkconfig iptables offYou need to restart the system to take effect, and then go to the browser to visit, ok finally succeeded this time, the familiar home page of tomcat came out. Next, prepare to start tomcat2. Before starting, change the port to 8081, because there will be a port conflict on the same virtual machine. After ok change it, after starting it, open a window, change 8080 to 8081, ok, let's go, the result There is no response, it's uzi, go back to putty to check the port monitoring, and found that 8080 and 8081 are listening, it should be correct, I think it should be an error when starting, so you can see the start through another Information command to start, ./catalina.sh run start, or open a putty session again, enter tomcat/logs and execute tail -f catalina.out to open the real-time log, and you can see the startup log when you start it again. . ok, let's start tomcat2 again, and it turns out that an error is reported. It seems that it is not reliable to check whether tomcat is started successfully by checking the port monitoring. The error log says that the shutdown port is already occupied, ok Change the shutdown port as well. Now, restart again, and still report an error, saying that the port of AJP/1.3 has been occupied, ok has also been changed, restart again, this time finally no error is reported, visit 8081 again, ok tomcat home page also comes out, both tomcats are It started normally and can be accessed.

           

           Note: Modify the port 8080 of tomcat2, the port of shutdown and the port of AJP/1.3 must be changed, otherwise an error will be reported when starting, indicating that the port is already occupied.

    

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326967737&siteId=291194637