Tomcat v8 on CentOS7

Preface

A memo when building Tomcat, which everyone loves as a Java application server, on CentOS 7 without yum. Unless you have a specific reason, I think it's faster to use yum.

Premise

Construction work

Preparation

Added tomcat user (username can be anything but easy to understand)

[root@localhost ]# useradd tomcat
[root@localhost ]# passwd tomcat

Java installation

Download the JDK rpm from the URL below http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Bring the dropped .rpm to the target server

[root@localhost ]# yum localinstall jdk-8u111-linux-x64.rpm
#root and tomcat.bash_export to profile JAVA_HOME=/usr/Java/jdk1.8.0_111/jre/Added

tomcat installation

Drop the binary from tomcat official and unzip => change owner / group In the example below, it is placed in / opt, but you can use any path you like.

[root@localhost ]# wget http://ftp.jaist.ac.jp/pub/apache/tomcat/tomcat-8/v8.5.6/bin/apache-tomcat-8.0.39.tar.gz
[root@localhost ]# tar xzvf apache-tomcat-8.0.39.tar.gz
[root@localhost ]# mv apache-tomcat-8.0.39 /opt/tomcat
[root@localhost ]# cd /opt/
[root@localhost ]# chown -R tomcat:tomcat tomcat

Service registration to systemd

You need to manually create / register this area, which yum will do automatically.

[root@localhost ]# vim /etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat 8
After=network.target

[Service]
User=tomcat
Type=forking
EnvironmentFile=/etc/sysconfig/tomcat
KillMode=none
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target



[root@localhost ]# vim /etc/sysconfig/tomcat

Java_HOME="/usr/Java/jdk1.8.0_111/jre/"
Java_OPTS="-DJava.security.egd=file:/dev/./urandom"

[root@localhost ]# systemctl daemon-reload

Registering a new service for firewalld (optional)

If you do not use firewalld for verification purposes, skip it and OK

[root@localhost ]# vim /usr/lib/firewalld/services/tomcat.xml

<service>
  <short>WWW (HTTP-tomcat)</short>
  <description>HTTP is the protocol used to serve Web pages. If you plan to make your Web server publicly available, enable this option. This option is not required for viewing pages locally or developing Web pages.</description>
  <port protocol="tcp" port="8080"/>
</service>

[root@localhost ]# systemctl restart firewalld
[root@localhost ]# firewall-cmd --add-service=tomcat --zone=public --permanent
success
[root@localhost ]# systemctl restart firewalld

Operation check

First, start Tomcat. Also, make sure that the service starts automatically when the OS starts.

[root@localhost ]# systemctl enable tomcat
[root@localhost ]# systemctl start tomcat
[root@localhost ]# systemctl status tomcat
[root@localhost ]# ss -nat | grep 8080
LISTEN     0      100                      :::8080                    :::*

Access http: // [ip_addr]: 8080 with a web browser, and when the familiar tomcat top page is displayed, it's OK.

Recommended Posts

Tomcat v8 on CentOS7
Jetty v8 on CentOS7
Install OpenFOAM v2006 on CentOS
JSP on tomcat
OpenVPN on CentOS 8
Change JDK and Tomcat versions on CentOS
Maven on CentOS 7 tutorial
Docker installation on CentOS 6
Use perltidy on CentOS 8
Install Golang on CentOS 8
Try OpenLiteSpeed on CentOS8
Install Neo4j 4.1.3 on centOS
Install Vertica 10.0 on CentOS 6.10
Zabbix 5 installation on CentOS 8
Use mod_auth_cas on CentOS 8
Install PostgreSQL 12 on Centos8
Install nginx on centOS7
Install Python 3 on CentOS 7
Install kuromoji on CentOS7
Use bat on Centos.
OpenJDK installation on CentOS 7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install CMS Made Simple v2.2.2 on LAMP on CentOS 7.3
1002 error on tomcat + webSocket
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Make exFat available on CentOS 7
Install tomcat on Sakura's VPS
Set up Gitolite on CentOS 7
Install Jenkins on Docker's CentOS
Install Apache on CentOS on VirtualBox
Introducing Let's Encrypt on CentOS 7
Java version change on CentOS
Install Ruby 2.7 on CentOS 7 (SCL)
Perform log rotation on centos
Install tomcat + eclipse on mac
Remote debug connection to tomcat running multiple times on CentOS7
Try DPDK20 SDK on CentOS7 â‘ Install
How to deploy Laravel on CentOS 7
Enable Openjdk10 and maven on CentOS
moved! JSF + CDI (Preferences) on Tomcat
Install Ruby 2.5 on CentOS 7 using SCL
Install Java Open JDK 8 on CentOS 7
Try putting CentOS 8 on Raspberry Pi 3
WordPress with Docker Compose on CentOS 8
Upgrade from MYSQL5.7 to 8.0 on CentOS 6.7
How to install MariaDB 10.4 on CentOS 8
Install apache 2.4.46 from source on CentOS7
Steps to install MySQL 8 on CentOS 8
Run tomcat shell script on java8
Use the iostat command on CentOS 8
I tried installing CentOS 8 on ESXi 6.7
Steps to install devtoolset-6 on CentOS 7
Use Docker CE (official) on CentOS 8
Install Java 9 on windows 10 and CentOS 7
I installed F-Revo CRM 7.3 on CentOS 7.7
Link Apache and Tomcat in a blink of an eye on CentOS 8
Try DPDK20 SDK on CentOS7 (2) Control DPDK driver