I found out that I made a mistake, I overwrote the lib folder of the new version I installed with the lib folder of the old version. Now it is showing the correct version.
root@SRVHML:/opt/tomcat/bin# ./version.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-amazon-corretto
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Server version: Apache Tomcat/9.0.105
Server built: May 7 2025 18:36:02 UTC
Server number: 9.0.105.0
OS Name: Linux
OS Version: 5.4.0-190-generic
Architecture: amd64
JVM Version: 1.8.0_392-b08
JVM Vendor: Amazon.com Inc.