From d15ff9412037e6f541793add98104feacf9e1cad Mon Sep 17 00:00:00 2001 From: mekya Date: Tue, 14 Nov 2023 16:07:44 +0300 Subject: [PATCH 1/3] Install java17 beyond 2.7.0 --- install_ant-media-server.sh | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 9c42fe1a..31b14c41 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -330,13 +330,8 @@ fi unzip $ANT_MEDIA_SERVER_ZIP_FILE check -if [[ $VERSION == 2.4* || $VERSION == 2.3* || $VERSION == 2.2* ]]; then - if [ "$ID" == "ubuntu" ]; then - $SUDO apt-get update -y - $SUDO apt-get install openjdk-11-jdk -y - check - fi -elif [[ $VERSION == 2.1* || $VERSION == 2.0* || $VERSION == 1.* ]]; then + +if [[ $VERSION == 2.1* || $VERSION == 2.0* || $VERSION == 1.* ]]; then if [ "$ID" == "ubuntu" ]; then $SUDO apt-get install openjdk-8-jre -y $SUDO apt purge openjfx libopenjfx-java libopenjfx-jni -y @@ -353,7 +348,13 @@ elif [[ $VERSION == 2.1* || $VERSION == 2.0* || $VERSION == 1.* ]]; then $SUDO sed -i '/JAVA_HOME="\/usr\/lib\/jvm\/java-11-openjdk-amd64"/c\JAVA_HOME="\/usr\/lib\/jvm\/java-8-openjdk-amd64"' $AMS_BASE/antmedia $SUDO sed -i '/Environment=JAVA_HOME="\/usr\/lib\/jvm\/java-11-openjdk-amd64"/c\Environment=JAVA_HOME="\/usr\/lib\/jvm\/java-8-openjdk-amd64"' $AMS_BASE/antmedia -else +elif [[ $VERSION == 2.4* || $VERSION == 2.3* || $VERSION == 2.2* ]]; then + if [ "$ID" == "ubuntu" ]; then + $SUDO apt-get update -y + $SUDO apt-get install openjdk-11-jdk -y + check + +elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7.0* ]]; then if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-11-jre-headless -y @@ -367,6 +368,21 @@ else export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ echo "JAVA_HOME : $JAVA_HOME" find /usr/lib/jvm/ -maxdepth 1 -type d -iname "java-11*" | head -1 | xargs -i update-alternatives --set java {}/bin/java +else + if [ "$ID" == "ubuntu" ]; then + $SUDO apt-get update -y + $SUDO apt-get install openjdk-17-jre-headless -y + check + elif [ "$ID" == "centos" ] || [ "$ID" == "almalinux" ] || [ "$ID" == "rocky" ] || [ "$ID" == "rhel" ]; then + $SUDO yum -y install java-17-openjdk-headless tzdata-java + ln -s $(readlink -f $(which java) | rev | cut -d "/" -f3- | rev) /usr/lib/jvm/java-17-openjdk-amd64 + fi + echo "export JAVA_HOME=\/usr\/lib\/jvm\/java-17-openjdk-amd64/" >>~/.bashrc + source ~/.bashrc + export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/ + echo "JAVA_HOME : $JAVA_HOME" + find /usr/lib/jvm/ -maxdepth 1 -type d -iname "java-17*" | head -1 | xargs -i update-alternatives --set java {}/bin/java + fi if ! [ -d $AMS_BASE ]; then From aca485842220ab0d8f10aabb355fa99fc15d8aa0 Mon Sep 17 00:00:00 2001 From: mekya Date: Wed, 15 Nov 2023 09:11:38 +0300 Subject: [PATCH 2/3] Fix syntax issue --- install_ant-media-server.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 31b14c41..84398d12 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -349,11 +349,13 @@ if [[ $VERSION == 2.1* || $VERSION == 2.0* || $VERSION == 1.* ]]; then $SUDO sed -i '/Environment=JAVA_HOME="\/usr\/lib\/jvm\/java-11-openjdk-amd64"/c\Environment=JAVA_HOME="\/usr\/lib\/jvm\/java-8-openjdk-amd64"' $AMS_BASE/antmedia elif [[ $VERSION == 2.4* || $VERSION == 2.3* || $VERSION == 2.2* ]]; then + if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-11-jdk -y check - + fi + elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7.0* ]]; then if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y @@ -368,7 +370,9 @@ elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7.0* ]]; then export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ echo "JAVA_HOME : $JAVA_HOME" find /usr/lib/jvm/ -maxdepth 1 -type d -iname "java-11*" | head -1 | xargs -i update-alternatives --set java {}/bin/java + else + # with 2.7.1 we start to use java17 if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-17-jre-headless -y From 0be9ef99224c2a4c2c6d114259d6df20b801a81c Mon Sep 17 00:00:00 2001 From: mekya Date: Sat, 25 Nov 2023 19:12:30 +0300 Subject: [PATCH 3/3] Install java17 for 2.8 and later --- install_ant-media-server.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 84398d12..9e994309 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -356,7 +356,7 @@ elif [[ $VERSION == 2.4* || $VERSION == 2.3* || $VERSION == 2.2* ]]; then check fi -elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7.0* ]]; then +elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7* ]]; then if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-11-jre-headless -y @@ -372,7 +372,7 @@ elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7.0* ]]; then find /usr/lib/jvm/ -maxdepth 1 -type d -iname "java-11*" | head -1 | xargs -i update-alternatives --set java {}/bin/java else - # with 2.7.1 we start to use java17 + # with 2.8 we start to use java17 if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-17-jre-headless -y