Java (Application)
Jump to navigation
Jump to search
Install
# shared/opt install schema v1.5.6 #### as common user #### # define applications vars export SOFTWARE_PATH="/home/shared/opt/software" export NAME="jdk" # example for java 21 export VERSION="21" export URL="https://download.java.net/java/GA/jdk${VERSION}/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz" # example for java 17 export VERSION="17.0.2" export URL="https://download.java.net/java/GA/jdk${VERSION}/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz" # example for java 15 export VERSION="15.0.1" export URL="https://download.java.net/java/GA/jdk${VERSION}/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz" # OR example for java 14 export VERSION="14.0.2" export URL="https://download.java.net/java/GA/jdk${VERSION}/205943a0976c4ed48cb16f1043c5c647/12/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz" # OR example for java 13 export VERSION="13.0.2" export URL="https://download.java.net/java/GA/jdk${VERSION}/d4173c853231432d94f001e99d882ca7/8/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz" # OR example for java 11 export VERSION="11.0.2" export URL="https://download.java.net/java/GA/jdk11/9/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz" # THEN su - -w SOFTWARE_PATH,NAME,VERSION #### as root #### # install packages and prepare destination path apt-get -q -y install wget coreutils findutils < /dev/null apt-get -q -y install tar gzip < /dev/null mkdir -m 777 "${SOFTWARE_PATH}/tmp_install/" "${SOFTWARE_PATH}/${NAME}_${VERSION}/" exit #### as common user #### umask 0027 cd "${SOFTWARE_PATH}/tmp_install" wget -c --no-check-certificate "${URL}" tar -xzf "openjdk-${VERSION}_linux-x64_bin.tar.gz" cd "jdk-${VERSION}" mv * "${SOFTWARE_PATH}/${NAME}_${VERSION}" cd su - -w SOFTWARE_PATH,NAME,VERSION #### as root #### # ensure permissions to destination path cd "${SOFTWARE_PATH}" chown -R root:users "${NAME}_${VERSION}" find "${NAME}_${VERSION}" -type d -exec chmod a-s,u+rwx,g+rx,g-w,o-rwx {} \; find "${NAME}_${VERSION}" -type f -exec chmod a-s,u+rw,g+r,g-w,o-rwx {} \; rm -rf tmp_install ln -s -f -T "${NAME}_${VERSION}" "${NAME}" exit #### as common user #### # test the application (you can put the follow in ~/.profile) export SOFTWARE_PATH="/home/shared/opt/software" export JAVA_HOME="${SOFTWARE_PATH}/jdk" export PATH="${JAVA_HOME}/bin:${PATH}" export LD_LIBRARY_PATH="${JAVA_HOME}/lib:${LD_LIBRARY_PATH}" java --version