CentOS7 deploys tomcat

First check if jdk is installed, then check if JAVA_HOME is configured

How to configure JAVA_HOME:

My jdk is already installed and it is 1.8

I need to find its installation directory

[root @ bogon xwg] # java - version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
[root@bogon xwg]# which java
/usr/bin/java
[root @ bogon xwg] # ls -lrt / usr / bin / java
lrwxrwxrwx. 1 root root 22 4月  12 2017 /usr/bin/java -> /etc/alternatives/java
[root @ bogon xwg] # ls -lrt / etc / alternatives / java
lrwxrwxrwx. 1 root root 71 4月  12 2017 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64/jre/bin/java
[root @ bogon xwg] # cd / usr / lib / jvm
[root@bogon jvm]# ls
java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
jre
jre-1.7.0
jre-1.7.0-openjdk
jre-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
jre-1.8.0
jre-1.8.0-openjdk
jre-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
jre-openjdk
Change the configuration file under the root user: vi   /etc/ profile

找到export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

Write below:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64

export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
 
 


:wq Save and exit after restarting the system with echo $JAVA_HOME , it will take effect

Then start tomcat, you need to authorize the file

In fact, it is very simple, that is, when executing tomcat today, the user does not have permission, so it cannot be executed.

Use the command chmod to modify the .sh permissions in the bin directory.

Such as chmod u+x *.sh

Execute here, OK.

 

Next start tomcat

Enter the bin directory of the tomcat server, and then execute the " ./startup.sh " command to start the tomcat server

 

But the virtual machine centos7 will involve permission issues:

Centos has used firewalld by default since 7, which is based on iptables. Although there is the core of iptables, the service of iptables is not installed. So you just need to stop the firewalld service:
sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

If you want to use iptables instead, you need to install the iptables service:
sudo yum install iptables-services
sudo systemctl enable iptables && sudo systemctl enable ip6tables
sudo systemctl start iptables && sudo systemctl start ip6tables

 

It can be accessed through the browser

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324496916&siteId=291194637