Install Tomcat 9 on CentOS 8

This post will cover installing Tomcat 9 on CentOS 8.

We’ll be using a bash script below, which is commented so you can see the steps.

We’ll install the latest stable release of Tomcat 9.x from Tomcat.org, as well as OpenJDK 8.

We’ll also update the tomcat-users.xml file to enable manager-gui and admin-gui roles and set their passwords to a random string.

Finally, we’ll create a service file and enable Tomcat to run as a systemd service.

 

As root, save the above script as tomcat9-centos8.sh and make it executable.

Run the script:

Upon completion, the GUI and Manager passwords will be displayed as below:

The random passwords will also be saved as auth.txt in the root directory.

You should now be able to access Tomcat at:

http://domain.com:8080 or http://IP:8080

Install PostGIS 3.x on CentOS 8

This post will cover install PostGIS 3.x on CentOS 8.

If you do not already have PostgreSQL 12 installed, do so here

PostGIS 3.x requires additional packages not available in the PostgreSQL repository.

Install the Epel repository for these dependencies:

With Epel installed, we can now use Yum to install the PostGIS 3.x packages from the PostgreSQL Repository:

Once completed, su to postgres and connect to the target database where you wish to enable PostGIS.

Below, we are using database ‘demo’:

Install the PostGIS extension using CREATE EXTENSION:

Check the PostGIS version installed:

Lets test out our extension using a basic example from https://postgis.net/docs/using_postgis_dbmanagement.html

Create a table with a GEOGRAPHY column:

Insert some data:

Select the name column values:

And run a Spatial Query:

Learn more at https://postgis.net/