Deploy JDK+Tomcat8 under CentOS

1、 Tomcat needs a JDK environment, refer to the previous article Install Java JDK8 under CentOS6, and install the JDK environment in advance

2、 Tomcat official website download tomcat8 binary distribution package apache-tomcat-8.5.38.tar.gz

3、 Upload to CentOS server and unzip

[ root@localhost ~]# tar -zxvf apache-tomcat-8.5.38.tar.gz

4、 Move the unzipped directory and rename it to /usr/tomcat

[ root@localhost ~]# mv apache-tomcat-8.5.38 /usr/tomcat

[ root@localhost ~]#

[ root@localhost ~]# useradd -M -d /usr/tomcat tomcat

[ root@localhost ~]# chown -R tomcat. /usr/tomcat

5、 Create the tomcat initial script in the /etc/init.d/ directory

#! /bin/bash

Tomcat: Start/Stop Tomcat

chkconfig: - 90 10

description: Tomcat is a Java application Server.

. /etc/init.d/functions

. /etc/sysconfig/network

JAVA_HOME=/usr/jdk1.8.0_201

export JAVA_HOME=/usr/jdk1.8.0_201

CATALINA_HOME=/usr/tomcat

TOMCAT_USER=tomcat

LOCKFILE=/var/lock/subsys/tomcat

RETVAL=0

start(){

echo "Starting Tomcat: "

su - TOMCAT_USER -c "CATALINA_HOME/bin/startup.sh"

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && touch $LOCKFILE

return $RETVAL

}

stop(){

echo "Shutting down Tomcat: "

$CATALINA_HOME/bin/shutdown.sh

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && rm -f $LOCKFILE

return $RETVAL

}

case "$1" in

start)

start

    ;;

stop)

stop

    ;;

restart)

stop

start

    ;;

*)

echo $"Usage: $0 {start|stop|restart}"

exit 1

    ;;

esac

exit $?

6、 Add the execution permission of tomcat startup service, and start tomcat

Then add it to the boot option, set the tomcat service to boot automatically

[ root@localhost ~]# chmod 755 /etc/init.d/tomcat

[ root@localhost ~]# /etc/init.d/tomcat start

[ root@localhost ~]# chkconfig --add tomcat

[ root@localhost ~]# chkconfig tomcat on

[ root@localhost ~]# chkconfig tomcat --list

7、 Open http://server IP:8080 port verification

Tips

  1. Modify tomcat web listening port

vi /usr/tomcat/conf/server.xml

Modify the default Connector port="8080" to Connector port="8880"

Then restart restart tomcat service

  1. View tomcat startup log

[ root@localhost ~]# tail -f /usr/tomcat/logs/catalina.2019-02-23.log

Recommended Posts

Deploy JDK+Tomcat8 under CentOS
Deploy GitBook under CentOS7
Centos7.6 deploy django+nginx+uwsgi
CentOS 7 deploy OpenLDAP+FreeRadius
Kickstart+PXE automatically deploy CentOS6.6
Compile Hadoop-2.7.6 under CentOS7.4
Install mysql5.7 under CentOS7
Install ActiveMQ under Centos7
Install PostgreSQL12 under CentOS7
Install CentOS under VMware
CentOS 6.8 deploy zookeeper cluster
CentOS 7 deploy saltstack service
Install mysql under Centos 7
Configure lamp under centos6.8
Install Jenkins under Centos 7
Deploy vuepress on centos7
Redis3 installation under Centos7
Centos6.8 deploy vnc service
Install MariaDB under MariaDB Centos7
Install mysql5.1 under CentOS6.5
Deploy Jenkin on centos7
Deploy Graylog open source log management system under CentOS7
Xen virtualization combat under CentOS 6.6
CentOS7 deploy vsftp (FTP) service
Deploy FTP server under ubuntu
Build docker environment under Centos6.5
Build OpenV** Server under CentOS7
Build OpenLDAP server under CentOS7
Redis cluster installation under CentOS
CentOS 7.2 deploy Node.js development environment
Configure static IP under CentOS 7
Install Oracle11gR2 database under CentOS6.9
CentOS 7.2 deploy mail server (Postfix)
3 partitioning tools under CentOS Linux
Install MySQL under Linux (CentOS 7)
Redis cluster installation under CentOS
Root password cracking under CentOS 7
SELinux security settings under CentOS
Install Java JDK8 under CentOS6
CentOS7.7 deploy k8s (1 master + 2 node)
Install MongoDB database under CentOS7
CentOS 6.8 under linux install mongodb
Set static IP under Centos
Install Mesos tutorial under CentOS7
Deploy the open source continuous integration tool Jenkins under CentOS7
Use Jexus 5.8.2 to deploy and run Asp.net core under Centos
CentOS7.7 deploy k8s (3 master + 3 node + 1 client)
Install and configure keepalived under CentOS 5.9
Compile and install LAMP under Centos 5.2
Use Nginx and u under CentOS
CentOS7.7 deploy k8s + Prometheus (1 master + 2 node)
CentOS 8 (2)
RabbitMQ cluster deployment record under Centos6.9
Installation under centos6.9 of jenkins learning
Deploy the mail system under Ubuntu 19.10
Build a PXC cluster under CentOS8
Elasticsearch cluster deployment record under CentOS7
Upgrade OpenSSL and OpenSSH under CentOS7
Install and deploy Gerrit under Ubuntu
Install Harbor mirror warehouse under CentOS
Build an FTP server under centos7