Tomcat deployment on Linux

Recently received a test environment deployment tasks before it to be moved to a remote test environment win7 Linux environment.

Big Brother have recently bored assigned this task to make trouble.

Began to dry

 

The first day, because it is a new machine, looks like what software did not do, I was the first to install the environment, met a lot of the pit, in addition to the first day to pass up the implementation of projects on win7 class file, without any progress.

The next day, the morning before the lack of legacy features padded, began boring, continue to engage in Linux, wonderful day yesterday did not get this morning within an hour to get. HAPPY ~

 

To summarize the operation

 

1. Upload project class files

Used on win7 loom ssh tool connected linux, the compressed file into a zip format, into the / usr / local / src path (user-level software under linux should be installed in the / usr / local, the source should be placed under the corresponding the src; system level it on the / usr under delete compressed file) after extracting zip

 1 Open the folder    cd / usr / local / src 

 

Use tools to upload source code down to the path, the pressure and remove the compressed package  
unzip  the unzip * .zip  
delete  RM -f * .zip

 

2. Upload JDK and Tomcat to under / usr / local

Decompression software, the format is generally Tomcat tar.gz format, a distinction JDK supports the median linux, 64-bit machines means 32 being given

file.tar -xvf tar  // extract the tar archive 
tar-xzvf file.tar.gz  // unpack tar.gz 
tar -xjvf file.tar.bz2    // unpack tar.bz2 
tar-xzvf file.tar.Z    // unpack the tar.Z 
unrar file.rar E  // extracting RAR 
the unzip file.zip  // extract the zip

3. General under Linux will self-loading openjdk, so java - version command can be seen, to be replaced uploaded oracle jdk

Open / etc / Profile document 
Vim / etc / profile  Press i to enter edit, enter the following contents, Shift + INSERT directly into  
#set Java Evironment 
Export the JAVA_HOME = / usr / local / jdk1.8.0_191 
Export the JRE_HOME the JAVA_HOME = $ / JRE 
Export the CLASSPATH =:. $ JAVA_HOME / lib: $ JRE_HOME / lib: $ the CLASSPATH 
Export the PATH = $ JAVA_HOME / bin: $ JRE_HOME / bin: $ the PATH 

press esc: wq to exit the save, 
: q exit without saving

After exiting the use of files need to be refreshed

$ source /etc/profile

View JDK version again

java -version   View jdk

4. Run tomcat

cd /usr/local/gx-tomcat-9.0.4/     enter tomcat 
. /startup.sh    run tomcat

View the Run Log

cd ..  Exit the parent directory 
cd logs  into the log directory 
ls   view files in current directory 
tail - f catalina.out  view the log 
press and hold Ctrl + z to exit Review 
./shutdown close tomcat

When you close the error should be forced to kill the process
$ ps - EF | grep the Java the Java tomcat change can
occur below

[root@localhost bin]# ps -ef|grep tomcat
root 21432 4060 20 14:22 pts/0 00:01:32 /usr/local/jdk1.8.0_191/jre/bin/java -Djava.util.logging.config.file=/usr/local/gx-tomca -9.0.4/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dignore.endorsed.dirs= -classpath /usr/local/gx-tomcat-9.0.4/bin/bootstrap.jar:/usr/local/gx-tomcat-9.0.4/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/gx-tomcat-9.0.4 -Dcatalina.home=/usr/local/gx-tomcat-9.0.4 -Djava.io.tmpdir=/usr/local/gx-tomcat-9.0.4/temp org.apache.catalina.startup.Bootstrap start
root 24194 4060 0 14:29 pts/0 00:00:00 grep --color=auto tomcat

Use kill -9 to kill the process

-9 21432 the kill    21432 is the process ID

5. Access remote linuxtomcat locally, if the new machine is generally not accessible, go to open firewall ports

Vim / etc / sysconfig / iptables     open the firewall configuration file 

in adding the above sentence -A-Host-Prohibited the INPUT ICMP -j REJECT---reject with 

-A the INPUT -p TCP TCP -m -m State --state NEW - 9010 dport - J ACCEPT
 
Note: 9010 is your tomcat access port (in /usr/local/gx-tomcat-9.0.4/conf/ see the changes in server.xml) 

Service iptables restart    restart firewall

After the restart tomcat firewall can not access it, you should restart tomcat

 

Guess you like

Origin www.cnblogs.com/luzc/p/10955616.html