Distribute Oracle JRE using Spacewalk, Red Hat Satellite and SUSE Manager and perform an clean installation

There are several OpenJDK versions for running Java applications under Enterprise Linux. This is adequate for the most applications but in some cases you might need the proprietary version by Oracle (e.g. because of support matrices of commercial third-party software).

On the JRE webseite you can find tarball and RPM package downloads.

If you are distributing the RPM package within a custom software channel using Spacewalk, Red Hat Spacewalk or SUSE Manager you will notice that there is a duplicate entry for the jre package. If you plan to install JRE afterwards the packages provided by the RHEL- / Scientific Linux- or CentOS channels are preferred.

You can fix this by using the following commando which disables all YUM repositories excepting your own (mychannel in this example) and installs the package:

1# yum --disablerepo="*" --enablerepo="mychannel" install jre

You can also make this exception persistent by altering the YUM configuration:

1# vi /etc/yum/pluginconf.d/rhnplugin.conf
2...
3[rhel-x86_64-server-6]
4exclude=java-1.?.0-openjdk java-1.?.0-gcj
5
6ESC ZZ

You will have to replace the software channel name depending on your distribution - some examples:

channeldescription
rhel-x86_64-server-6RHEL 6 x86_64 base channel
centos6-base-x86_64CentOS 6 x86_64 base channel
centos6-updates-x86_64CentOS 6 x86_64 update channel

If you don't know which channels are containing packages providing jre packages you might want to have a look at this command:

1# yum whatprovides jre|grep -i Repo|sort -u
2Repo        : centos6-base-x86_64
3Repo        : centos6-updates-x86_64

After the installation you might notice that Java applications are not able to be executed. Having a look at the output of the following output tells you that there is a missing library:

1# ldd $(which java)
2        linux-vdso.so.1 =>  (0x00007fff677ff000)
3        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003e68800000)
4        libjli.so => not found
5        libdl.so.2 => /lib64/libdl.so.2 (0x0000003e68c00000)
6        libc.so.6 => /lib64/libc.so.6 (0x0000003e68400000)
7        /lib64/ld-linux-x86-64.so.2 (0x0000003e68000000)

Thanks to find I found out very quickly that this library is part of the RPM package but is stored in a different location than the default paths (like /usr/lib). To fix this issue you need to create a configuration file and force the library cache to be updated so that the file can be found.

1# echo "/usr/java/jre1.7.0_51/lib/amd64/jli" > /etc/ld.so.conf.d/oracle-jre.conf
2# ldconfig -p|head -n1
3438 libs found in cache `/etc/ld.so.cache'
4# ldconfig ; ldconfig -p|head -n1
5439 libs found in cache `/etc/ld.so.cache'

The output of the two last commands is important - it's no doubt that the library was detected and added to the cache.

Running Java applications should now work like a charm:

1# java -version
2java version "1.7.0_51"
3Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
4Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

🙂

Translations: