How to install Atlassian Confluence (using the "installer" download), using another JRE than the embedded one ============================================================================================================= - When: 2019-04 - For Confluence 6.15.1 - On Linux/Unix (actually Fedora 29) - See also: https://jira.atlassian.com/browse/CONFSERVER-57895 "Installing Confluence in OpenSUSE Tumbleweed through the installer fails" So we have a problem because installation of Confluence using the binary INSTALL4J install module fails: # bash atlassian-confluence-6.15.1-x64.bin Unpacking JRE ... Starting Installer ... java.lang.NullPointerException at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219) at sun.awt.FontConfiguration.init(FontConfiguration.java:107) at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774) at sun.font.SunFontManager$2.run(SunFontManager.java:431) at java.security.AccessController.doPrivileged(Native Method) at sun.font.SunFontManager.<init>(SunFontManager.java:376) ...and the workarounds doesn't work: https://jira.atlassian.com/browse/CONFSERVER-57895 Let's install this with another JRE than the embedded one. 0) Go to your home directory (in this case, /home/fedora) cd ~ 1) Download "atlassian-confluence-6.15.1-x64.bin" from https://www.atlassian.com/software/confluence/download and put it into the home directory. (Apparently there is a tar somewhere, but I didn't find it; maybe I'm getting confused with all that playful 2019 web design) (Update: I'm stupid! The dropdown menu at said page has the option to get the tar.gz or zip file, so if you are reading this it's better to get on with the tar.gz instead of unpacking elements the hard way as is done below. Go directly to page https://confluence.atlassian.com/doc/installing-confluence-on-linux-from-archive-file-255362363.html OTOH, you may want to keep going with the installer-based way but still have problems, then read on) Check MD5 sum: md5sum atlassian-confluence-6.15.1-x64.bin ff02e94f5fdf4718d76cea0583e57e8d atlassian-confluence-6.15.1-x64.bin This file is a concatenation of: [A shell script (partly from install4j I reckon)] [The confluence server payload] [A tar.gz file that unpacks into Install4J stuff with an embedded JRE] 2) We won't rely on the embedded JRE! Make sure you have a Java 8 JRE on the system. In this case, I grab a Java 8 JRE from Oracle and put it into my home dir under /home/fedora/jre/jre: cd ~ mkdir jre cd jre tar xzf ../jre-8u201-linux-x64.tar.gz ln -s jre1.8.0_201 jre cd ~ 3) On this system the system's JDK in /usr/local/java/jdk8_64_oracle Change this in "script.sh" as needed! See below!! 4) Create a directory for further installation operations. mkdir operations cd operations 5) Extract the installation script (at the start of the binary). There are 673 lines of interest! head -673 ../atlassian-confluence-6.15.1-x64.bin > script.sh chmod +x script.sh This script needs some serious attention by a professional, it's not even indented right. Me sad!! :-( 6) Extract the "install4j installer" (at the far end of the binary) There are 53068000 byte of interest (found by inspecting the script.sh) tail -c 53068000 ../atlassian-confluence-6.15.1-x64.bin > sfx_archive.tar.gz 7) Good sizes? ls -l 19292 Mar 30 15:15 script.sh 53068000 Mar 30 15:15 sfx_archive.tar.gz 8) Unpack the installer and remove the embedded JRE mkdir sfx_archive cd sfx_archive tar xzf ../sfx_archive.tar.gz rm -f jre.tar.gz 9) Skip over the installation of "fontconfig" package, we already have that! rpm --query fontconfig fontconfig-2.13.1-3.fc29.x86_64 Yup we do. 10) Start editing the "script.sh"! cd ~/operations cp script.sh script.sh.orig vim script.sh a) Delete all the lines down to the second "#!/bin/sh" shebang line! b) Go to the line TAR_OPTIONS=... which is the first line beyond the function declarations c) Simplify all the stuff underneath as described below, change those constants accordingly. d) Results in a new script.sh. --> There is no need to patch the "module" (i.e. the original confluence download) 11) Run the script.sh as root (by sudo if need be) 12) On failure, you can always uninstall using /opt/atlassian/confluence/uninstall.sh As we have removed all the command to "remove recursive" after installation, temporary directory with files will be in /tmp/tmp_confluence_install_2019-03-30T15:27:22 or similar. Script fragment to replace part of the original installation script follows: -------8<-------8<-------8<-------8<------- if [ -z "$app_java_home" ]; then if [ -f "$app_home/.install4j/inst_jre.cfg" ]; then read file_jvm_home < "$app_home/.install4j/inst_jre.cfg" test_jvm "$file_jvm_home" if [ -z "$app_java_home" ] && [ $tested_jvm = "false" ]; then if [ -f "$db_file" ]; then rm "$db_file" 2> /dev/null fi test_jvm "$file_jvm_home" fi fi fi } # ============ # RIP & REPLACE WHITH WHAT IS BELOW # ============ sfx_archive_dir=/home/fedora/operations/sfx_archive # contains directory "user"! jre_home=/home/fedora/jre/jre # our JRE! # Create a temporary installation direction (won't delete this afterwards, # you may want to do that yourself) isodate=$(date +%Y-%m-%dT%H:%M:%S) tmp_dir=/tmp/tmp_confluence_install_$isodate mkdir "$tmp_dir" || { echo "Could not create dir $tmp_dir. Aborting." exit 1 } cp -a "$sfx_archive_dir"/* "$tmp_dir" cd "$sfx_archive_dir" || { echo "Could not cd to $sfx_archive_dir. Aborting." exit 1 } sfx_dir_name=$(pwd) local_classpath="" i4j_classpath="i4jruntime.jar" add_class_path "$i4j_classpath" LD_LIBRARY_PATH="$sfx_dir_name/user:$LD_LIBRARY_PATH" DYLD_LIBRARY_PATH="$sfx_dir_name/user:$DYLD_LIBRARY_PATH" SHLIB_PATH="$sfx_dir_name/user:$SHLIB_PATH" LIBPATH="$sfx_dir_name/user:$LIBPATH" LD_LIBRARYN32_PATH="$sfx_dir_name/user:$LD_LIBRARYN32_PATH" LD_LIBRARYN64_PATH="$sfx_dir_name/user:$LD_LIBRARYN64_PATH" export LD_LIBRARY_PATH export DYLD_LIBRARY_PATH export SHLIB_PATH export LIBPATH export LD_LIBRARYN32_PATH export LD_LIBRARYN64_PATH # Add install4j debugging messages! INSTALL4J_ADD_VM_PARAMS="$INSTALL4J_ADD_VM_PARAMS -Di4j.vpt=true -Dinstall4j.debug=true -Dinstall4j.logToStderr=true" for param in $@; do if [ `echo "W$param" | cut -c -3` = "W-J" ]; then INSTALL4J_ADD_VM_PARAMS="$INSTALL4J_ADD_VM_PARAMS `echo "$param" | cut -c 3-`" fi done if [ "W$vmov_1" = "W" ]; then vmov_1="-Di4jv=0" fi if [ "W$vmov_2" = "W" ]; then vmov_2="-Di4jv=0" fi if [ "W$vmov_3" = "W" ]; then vmov_3="-Di4jv=0" fi if [ "W$vmov_4" = "W" ]; then vmov_4="-Di4jv=0" fi if [ "W$vmov_5" = "W" ]; then vmov_5="-Di4jv=0" fi echo "Starting Installer ..." # Where is the System Java (not the same as the JRE used in installation) app_java_home=/usr/local/java/jdk8_64_oracle # The "module" is the file that we downloaded. The middle of the file contains the # Confluence payload! module_name="/home/fedora/atlassian-confluence-6.15.1-x64.bin" old_pwd=/home/fedora # Simplified command line running installer "$jre_home/bin/java" \ "-Djava.awt.headless=true" \ -Dinstall4j.jvmDir="$app_java_home" \ -Dexe4j.moduleName="$module_name" \ -Dexe4j.totalDataLength=618037334 \ -Dinstall4j.cwd="$old_pwd" \ "-Dinstall4j.executionMode=console" \ "-Dsun.java2d.noddraw=true" \ "$vmov_1" \ "$vmov_2" \ "$vmov_3" \ "$vmov_4" \ "$vmov_5" \ $INSTALL4J_ADD_VM_PARAMS \ -classpath "$local_classpath" \ com.install4j.runtime.launcher.UnixLauncher launch 0 0 0 com.install4j.runtime.installer.Installer "$@"