Installing Oracle Java
Using java requires having grsec play nice with the binaries. You may also want to install the JDK instead of the JRE depending on your needs.
This guide assumes you're running as root.
Download XXX-XXX-linux-x64.tar.gz from either the JRE or JDK section here: https://www.oracle.com/technetwork/java/javase/downloads/index.html
mkdir -p /opt/java cd /opt/java sudo tar -zxvf XXX-XXX-linux-x64.tar.gz
Take note of the directory, e.g. /opt/java/jdk1.8.0_121, create a symbolic link as the current version:
ln -s /opt/java/jdk1.8.0_121 /opt/java/current
Create a file in /etc/profile.d/java.sh:
export JAVA_HOME=/opt/java/current export PATH=$PATH:$JAVA_HOME/bin
Execute this script or restart your shell:
sh /etc/profile.d/java.sh
Now we need manage grsec with paxctl. Use this command to check if its installed:
which paxctl
If nothing comes up install it:
apk add paxctl
Now in your /opt/java/XXX/bin folder, execute:
paxctl -c java paxctl -m java
If you have the JDK, you need to do the same to javac:
paxctl -c javac paxctl -m javac
You can do this for any other binary you need to use.
NOTE: some users have reported they had to use this command to get it working:
setfattr -n user.pax.flags -v "mr" java setfattr -n user.pax.flags -v "mr" javac