6.1. Java

6.1.1. Automatic Install

Note

If you use Zimbra Collaboration Suite you could use Java environment embedded with suite. No need to install separate Java package. Only Zimbra 8.7 and later is supported.

6.1.1.1. Red Hat Linux, CentOS, Fedora, Oracle Linux, etc.

On the command line, type (with root privileges):

yum -y install java-1.8.0-openjdk

6.1.1.2. Debian, Ubuntu, etc.

On the command line, type (with root privileges):

apt-get -y install openjdk-8-jre

6.1.2. Manual Install

Go to https://java.com/en/download/linux_manual.jsp web site and download JRE tarball based on your processor architecture (32-bit or 64-bit).

You should have downloaded jre-8u101-linux-XXXX.tar.gz file (update version can be different, here u101). Copy one of these files to you mail server.

Unpack the tarball:

tar zxvf jre-8u101-linux-x64.tar.gz

Move extracted files to /opt directory (as root):

mv jre1.8.0_101 /opt

Change owner of the /opt/jre1.8.0_101 directory (as root):

chown -R root:root /opt/jre1.8.0_101

Create symbolic link for easier use (as root):

ln -s /opt/jre1.8.0_101/ /opt/jvm

Now PATH environment variable need to be configured. Create a file java.sh in /etc/profile.d directory and put below content to it (as root):

export PATH=$PATH:/opt/jvm/bin

To apply changes to current session you need to relogin or invoke command:

source /etc/profile.d/java.sh

6.1.3. Set JAVA_HOME environment variable

Open /etc/environment file and add the following line:

JAVA_HOME="<PATH_TO_JRE>"

Where variable <PATH_TO_JRE> is different between distributions, so you need to verify your path. Below are two examples from popular distributions, one from manual installation and Zimbra.

Red Hat Linux, CentOS, Fedora, Oracle Linux, etc.

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-7.b10.el7.x86_64/jre

Debian, Ubuntu, etc.

/usr/lib/jvm/java-8-openjdk-amd64/jre

Manual Install

/opt/jvm

Zimbra 8.7 and later

/opt/zimbra/common/lib/jvm/java

So if you would like to use manual installation path, line in /etc/environment file should look like this:

JAVA_HOME="/opt/jvm"

With Zimbra installation, like this:

JAVA_HOME="/opt/zimbra/common/lib/jvm/java"

To apply environment file invoke command:

source /etc/environment

6.1.4. Confirm Java Installation

To check if Java is working run command:

$JAVA_HOME/bin/java -version

If everything is OK, you should get result like this:

java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

6.1.5. Memory allocation

Application by default uses standard sizes for Java memory usage. Minimal size is set to 128MB and maximum to 1024MB, if needed these two values can be changed.

Edit /opt/msh-traffic-policy/etc/config.cf file and add these two lines:

JAVA_XMS=128M
JAVA_XMX=1024M

Where JAVA_XMS is minimal size of memory usage and JAVA_XMX is maximum. After change restart application services:

/etc/init.d/msh-tp-settings restart
/etc/init.d/msh-tp-milter restart