How to migrate Security Server and Central Server from Ubuntu OpenJDK 8 to Eclipse Temurin 8 from Adoptium

Ubuntu OpenJDK 8 support ended on April 2021*.  It is encouraged to migrate from the Ubuntu OpenJDK to an alternative OpenJDK distribution like Eclipse Temurin 8 from Adoptium which will be supported until 2026.
(* Despite the end-of-support declaration, Ubuntu updated OpenJDK 8 to the patch release 8u312 on 2021-12-17. It is unclear whether there will be further updates.)

This document describes two ways, manual or with package manager, to install Eclipse Temurin 8 on your Ubuntu system.

These instructions require X-Road version 6.26.0 or later.

Installing with package manager (apt)

(See https://blog.adoptium.net/2021/12/eclipse-temurin-linux-installers-available/)

1. Import the repository GPG key

wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo apt-key add -

2. Configure apt repository

echo "deb https://packages.adoptium.net/artifactory/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/adoptium.list

For example, if you are running Ubuntu 20.04 (Focal Fossa) the above command would be equivalent to:
echo "deb https://packages.adoptium.net/artifactory/deb focal main" | sudo tee /etc/apt/sources.list.d/adoptium.list

3. Install the Java package (currently only full JDK is available)

sudo apt update && sudo apt install temurin-8-jdk

4. Check the installation path.

dpkg -L temurin-8-jdk | grep '/bin/java$'

In this case it is /usr/lib/jvm/temurin-8-jdk

5. Set Java home path in /etc/xroad/services/local.conf

/etc/xroad/services/local.conf
JAVA_HOME=/usr/lib/jvm/temurin-8-jdk

Installing manually

Note that manual installs are not automatically updated.
See also: https://adoptium.net/installation.html?variant=openjdk8&jvmVariant=hotspot#x64_linux-jre

For example installing latest Java 8 into the /opt directory (uses the Adoptium API to get the link to latest version available)

cd /opt 
wget -O temurin-8-jre.tar.gz https://api.adoptium.net/v3/binary/latest/8/ga/linux/x64/jre/hotspot/normal/eclipse
tar xvf temurin-8-jre.tar.gz
# take note of the output directory, e.g ./jdk8u312-b07-jre
rm temurin-8-jre.tar.gz

2. Set the Java home path in /etc/xroad/services/local.conf

/etc/xroad/services/local.conf
JAVA_HOME=/opt/jdk8u312-b07-jre 

Optional steps

Removing the old Java distribution

Note that if you used the manual installation method, removing the Ubuntu OpenJDK package is not possible because the central/security server depends on it.

You need to be sure that it is safe to remove the old Java distribution e.g. that it is not used by any other software you might have installed.

UBUNTU – apt
sudo apt remove openjdk-8-jdk