Install Tomcat On Server (Mac & Linux)

How To Develop And Deploy Your Web App (Angular + Tomcat Server + MySQL) — Part 2

Mia
3 min readJul 26, 2020

Part 1: Develop First Web Page With Angular
Part 2: Install Tomcat On Server (Mac & Linux)
Part 3: Develop Java API Running On Tomcat Server
Part 4: Install MySQL And Create Database (Local & Remote Server)
Part 5: Connect To MySQL Database in Java API and Deploy It On Tomcat Server (Local Server & Remote Server)

Taipei 101 in Taiwan (By Mia)

In part 1, I introduce how to build the frontend page. In this part, I will show you how to install Tomcat on server.

  • Prerequisites
  • Introduction
  • Install Tomcat On Server (Mac)
  • Install Tomcat On Server (Linux)
  • Conclution

Prerequisites

  • A Linux server: CentOS 7 (How to own your VPS? Check my another article to Setup your VPS)
  • My local computer is MacOS
  • Java on remote server (Java version: 1.8)
  • Tomcat on remote server (Tomcat version: 7.0.76)

Note: You can choose other code editors or version you like. Those just for your reference.

Introduction

During the project development period, I usually deploy on my local computer first to test the functions. I need to create the same running environment of my remote server on my local computer. Which means my local computer and remote computer both have Tomcat and MySQL database. Once I finish my backend program, I will deploy it on remote server from my local computer.

There’s a slightly difference in the deployment process between local computer (Mac) and remote computer (Linux):

  • Installation steps are different
  • Tomcat commands are different
// Mac
/* /Libray/Tomcat is your Tomcat directory */
$ /Library/Tomcat/bin/startup.sh # start tomcat
$ /Library/Tomcat/bin/shutdown.sh # stop tomcat
// Linux CentOS
$ systemctl start tomcat # start tomcat
$ systemctl stop tomcat # stop tomcat
$ systemctl status tomcat # check tomcat status

Install Tomcat On Server (Mac)

Please follow this tutorial to install Tomcat on Mac.

Notes:

Tomcat starts successfully on local server
  • If you can’t open this page, try /Library/Tomcat/startup.sh to start Tomcat.

Install Tomcat On Server (Linux)

Please follow this tutorial video to install Tomcat.

Notes:

  • First of all, make sure you have java on remote server. (Use java -version to check.)
  • Recommand to use yum to install on CentOS.
  • yum install tomcat tomcat-webapps tomcat-admin-webapps, include three of them are enough.
  • In the tutorial video (Begins at 1:42), this admin settings step is optional because we just use the default root username and null password in this article. Of course, you can set a username and password if you like. Just make sure this username and password will be used in the database connection step.
  • Do not execute the systemctl start tomcat command if you have started your tomcat. To be safe, check your tomcat running status first before you start tomcat using systemctl status tomcat:
Tomcat on remote server
  • Open your browser and enter http://your-remote-server-ip:8080. Tomcat server starts successfully:
Tomcat starts successfully on remote server

References

More…

The following parts could be found in my other articles.

--

--