Freitag, 9. Januar 2015

How To Install and manage Java JDK on Oracle Linux

Every Time I set up an Oracle Linux server, I ask myself, how have I done it last time ...

1. Check which Java Version (JDK7, JDK8, ...) is certified with your software.
e.g. Oracle Fusion Middleware supported system configurations:
http://www.oracle.com/technology/software/products/ias/files/fusion_certification.html

2. Check support policy, esp. end of life for your desired Java Version
http://www.oracle.com/technetwork/java/javase/downloads/eol-135779.html

3. Download JDK
http://www.oracle.com/technetwork/java/javase/downloads/index.html

4. Install JDK

# ls -l jdk*
-rw-r--r--. 1 oracle oinstall 126679286 Jan  9 13:01 jdk-7u71-linux-x64.rpm
-rw-r--r--. 1 oracle oinstall 142191827 Jan  9 13:06 jdk-8u25-linux-x64.rpm


# rpm -Uhv jdk-7u71-linux-x64.rpm
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
    rt.jar...
    jsse.jar...
    charsets.jar...
    tools.jar...
    localedata.jar...
    jfxrt.jar...


5. Check Java Version

# java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)


If this is your expected Java Version - fine! Your are done!
If you still have a pointer to an older version, move on ...

...

6. A non expected Java Version is present?     lets say, JDK8 is still present, but you need to move back to JDK7

# java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


7. Check Java install locations

# ls -l /usr/java/
total 8
lrwxrwxrwx. 1 root root   16 Jan  9 13:24 default -> /usr/java/latest
drwxr-xr-x. 8 root root 4096 Jan  9 13:49 jdk1.7.0_71
drwxr-xr-x. 9 root root 4096 Jan  9 13:40 jdk1.8.0_25
lrwxrwxrwx. 1 root root   21 Jan  9 13:40 latest -> /usr/java/jdk1.8.0_25


8. Make use of alternatives system to switch between versions

8.1 Syntax of alternatives

# /usr/sbin/alternatives
alternatives version 1.3.49.3 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: alternatives --install
                    [--initscript ]
                    [--slave ]*
       alternatives --remove
       alternatives --auto
       alternatives --config
       alternatives --display
       alternatives --set

common options: --verbose --test --help --usage --version
                --altdir --admindir


8.2 Register your JDKs for alternatives

usage: alternatives --install

# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_71/bin/java 17071

(where priority represents 17071 for jdk1.7.0_71)

# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_25/bin/java 18025

(where priority represents 18025 for jdk1.8.0_25)

8.3 Now to switch between the versions

8.3.1 Check current java version, again

# java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


8.3.2 Change the current java version

 # /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/java/jdk1.7.0_71/bin/java
*+ 2           /usr/java/jdk1.8.0_25/bin/java

Enter to keep the current selection[+], or type selection number: 1


8.3.3 Check your current java version has changed

# java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)


9. Keep your path JDK dynamic

The idea is, when you install for example WebLogic Server, to use a dynamic location to your JDK.
I do this with a symbolic link.
I have a folder /opt/oracle/java where I create a symbolic link, that points to the jdk.
As normal user I create the symbolic link:

$ ln -s /usr/java/jdk1.8.0_25 /opt/oracle/java/java

When an updated jdk version in available, after install I only change the symbolic link:

$ rm /opt/oracle/java/java
$ ln -s /usr/java/jdk1.8.0_31 /opt/oracle/java/java

For the WebLogic Server, the path to java will remain. No reconfiguration is needed.
So I only have to restart the WebLogic Server to use the latest JDK.

10. Tidy up! - delete out of date JDKs

10.1 Remove rpm

To delete the out-of-date versions of the JDK:
Query for all installed JDK rpms:
# rpm -aq | grep -i jdk
jdk1.8.0_31-1.8.0_31-fcs.x86_64
jdk-1.7.0_85-fcs.x86_64
jdk1.8.0_60-1.8.0_60-fcs.x86_64

In this example, I need to remove the jdk1.8.0_31:
# rpm -e jdk1.8.0_31-1.8.0_31-fcs

Check that the rpm has been deleted:
# rpm -aq | grep -i jdk
jdk-1.7.0_85-fcs.x86_64
jdk1.8.0_60-1.8.0_60-fcs.x86_64

10.2 De-register the java alternatives entry

Now we need to de-register the jdk in the alternatives configuration:
Current alternatives configuration:
# /usr/sbin/alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/java/jdk1.7.0_75/bin/java
   2           /usr/java/jdk1.8.0_31/bin/java
*+ 3           /usr/java/jdk1.8.0_60/jre/bin/java

We need to remove selection No 2:
# alternatives --remove java /usr/java/jdk1.8.0_31/bin/java

Check again:
# /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/java/jdk1.7.0_75/bin/java
*+ 2           /usr/java/jdk1.8.0_60/jre/bin/java

Enter to keep the current selection[+], or type selection number: 2


Voilà!

Samstag, 27. Dezember 2014

Rasperry PI Setup

OS
    $ cat /etc/issue.net | head -1
    Raspbian GNU/Linux 7

Updating Raspberry Firmware & Kernel Modules
    $ sudo rpi-update
    $ sudo reboot
-----
Updating Software
1. Update software catalog
    $ sudo apt-get update
2. Update installed packages
    $ sudo apt-get upgrade
    $ sudo reboot
(3.) Clean software catalog
    $ sudo apt-get autoclean
(4.) Remove unneeded packages
    $ sudo apt-get autoremove
-----
Issues I had:

HDMI of Rasperry PI not working
    RCA Video out was working
    Fix:
    # hdmi_safe=1
    Afterwarts HDMI worked fine.
-----
Upgrading OS from wheezy to jessie

1. Check OS Version
    $ cat /etc/issue.net | head -1
    Raspbian GNU/Linux 7 2. Backup your whole SD Memory card
3. Update your current wheezy OS, so it is up-2-date
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get dist-upgrade
4. Edit /etc/apt/sources.list
    Change "wheezy" to "jessie".
5. Update & upgrade to "jessie"
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get dist-upgrade
6. Reboot your OS.
    $ sudo reboot
7. Verify OS Version
    $ cat /etc/issue.net | head -1
    Raspbian GNU/Linux 8
8. Backup again.
    Good time to backup your upgraded system.
    I recomment to clone the whole SD Memory card, again.
9. Done.
-----
setting up X-Server on MAC OS
http://xquartz.macosforge.org/landing/
-----
Install  Oracle Java Embedded Suite 7.0
1. Download Software
http://www.oracle.com/technetwork/java/embedded/embedded-suite/downloads/index.html
2. Copy software to raspberry pi

scp USER@IP_OF_HOST:/Volumes/Macintosh_HD/Users/USER/Downloads/jes-7.0-ga-bin-b11-linux-arm-runtime-15_nov_2012.zip .

scp USER@IP_OF_HOST:/Volumes/Macintosh_HD/Users/USER/Downloads/ofm_oep_embedded_11_1_1_7_1_linux.zip

3. Unzip
sudo mkdir /opt/oracle
sudo chown pi /opt/oracle
sudo chmod 775 /opt/oracle
cd /opt/oracle/
mkdir java
cd java/
mkdir jes7.0/
cd jes7.0/
mkdir jre
cd jre/
unzip jes-7.0-ga-bin-b11-linux-arm-runtime-15_nov_2012.zip -d opt/oracle/java/jes7.0/jre
export JAVA_HOME=/opt/oracle/java/jes7.0/jre
java -version

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)

4. Install Java Embedded Suite

Samstag, 8. November 2014

Avahi fails on Oracle Linux startup

avahi-daemon fails on startup of Oracle Linux.

What is Avahi? - Please see here in wikipedia.

I decided to disable the daemon on my Oracle Linux Server:
 
service avahi-daemon stop 
chkconfig avahi-daemon off

Freitag, 31. Oktober 2014

Collection of needful Mac OS commands

  • disable. that draft documents will be stored in icloud
    •  defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

Samstag, 8. Februar 2014

re-use of Oracle Linux VBox image

For every Linux distribution I have created an empty Oracle Linux image, containing all packages and kernel settings to quickly install Oracle Software.

Re-using this image needs some modifications to hostname, naming etc. This blog entry is mainly for me not to forget something.

1. Import Oracle Linux VM.
2. Update packages
    # yum update
    Afertwards reboot to start with updated kernel.
    # reboot
3. Upgrade VBox guest additions
4. Identify Oracle Linux Distribution
    # cat /etc/issue.net
5. Change Hostname
   a) Change Hostname in /etc/sysconfig/network
   b) Change Hostname in /etc/hosts
6. Changefixed IP address
   a) change in Menue -> Preferences -> Network Connections
   b) Change in /etc/hosts
7. Verify all changes during startup
    # reboot
    Hit the esc- button during startup to see detailed startup information.
    Verify that all services are ok.
8. Shrink VBox
    Finally it is good to shrink the image before exporting.
    See: http://fmw-deutsch.blogspot.de/2013/10/vbox-images-schrumpfen.html
    # dd if=/dev/zero of=zero.file
    When the comand has finished, delete the file and shutdown the VM:
    # rm zero.file
    # poweroff
    Navigat in a terminal to the *vdi file. Now shrink the file:
    VBoxManage modifyhd *.vdi --compact
9. Export the VM. Done.
    (Without shrinking my image size was 2.47GB, only 1.58GB after shrinking!)

Donnerstag, 4. Juli 2013

HowTo Install adobe flash player for firefox 64bit on Oracle Linux

  1. Get flash Player for Linux 64bit:
    http://get.adobe.com/flashplayer/
    I downloaded both, the
    - yum for linux (to easy get updates with yum in future)
    - *.tar.gz version
  2. Identify as root user and install yum version download with
    package installer or by command line as user root i.e.:
    # rpm -Uhv adobe-release-x86_64-1.0-1.noarch.rpm
  3. Now we have to move the "libflashplayer.so" into the mozilla plugin directory.
    1. Open a terminal window, become root user:
      # su -
      Unzip the *.tar.gz file
      # gunzip *.tar.gz
      The *.tar file remains.
      # tar -xf *.tar
      This should extract the "libflashplayer.so" file we need to move to the mozilla plugins directory.
    2. Verify the mozilla plugin directory exists:
      /usr/lib64/mozilla/plugins  (if the plugins directory does not exist, create it)
    3. Close your firefox, if it is still running.
    4. Copy the "libflashplayer.so" to the mozilla plugins directory:
      cp libflashplayer.so /usr/lib64/mozilla/plugins
  4. Open Firefox again and test your flash player configuration:
    http://www.adobe.com/uk/software/flash/about/

Freitag, 1. Februar 2013

Installing Oracle JDeveloper 11.1.1.6.0 on Mac OS X 10.8.2 Mountain Lion

1. Take care: Version Oracle JDeveloper 11.1.1.6.0 is not Version Oracle JDeveloper 11.1.1.6.0 !
There are more than one Version of Oracle JDeveloper 11.1.1.6.0
Both start with  Oracle JDeveloper 11.1.1.6.0



The latest version has *CLOUD* within the Version Title.
If you want to try Oracle Cloud, than you need to download this version in order to have the cloud connection availabe within the database navigator.

2. Download the Oracle Software:So you might want to download the latest Version 11.1.1.6.0.
(Although a Version Oracle JDeveloper 11g (11.1.2.3.0) (Build 6276.1) is availabe, this Version is not suitable if you want to build SOA, BPM, WebCenter or Oracle Cloud applications.
Download Oracle JDeveloper 11.1.1.6.0:
http://www.oracle.com/technetwork/developer-tools/jdev/downloads/jdeveloper11116-1377208.html

3. Install Oracle JDeveloper 11.1.1.6.0
ATTENTION: This not trivial as well. If you try to install Oracle JDeveloper 11.1.1.6.0 with JDK 1.7.x it will fail with error: "A fatal error has occurred.  This application will terminate."


So we need to start the installation with JDK 1.6.x.
But: you might kbow, that the responsibility for Java has been moved from Apple to Oracle...

Start your terminal.
java -version

java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)


Now we create a dummy folder with a symbolic link:
sudo mkdir -p /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/jre/lib

cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/jre/lib/

sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/classes/classes.jar rt.jar

Now we set the environment to Java 1.6.x:

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
export PATH=$JAVA_HOME/bin:$PATH

Now check the java version, again:
java -version

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)


Perfect.
Now we can navigare to the download folder and start the installer:
java -jar jdevstudio11116install.jar

Your Oracle JDeveloper 11.1.1.6.0 install shoud be successful.

And now you should also be able to see the cloud connection option in the Database Navigator:
Enjoy!