Preamble
One of the tasks of UNIX/Linux administration is the installation of software. In this article we will discuss the installation of Glassfish - a Java application server from Oracle on the Solaris platform:-
Prerequisites
For the installation we will need Solaris OS installed and a JDK . For an example manual on how to install Solaris, see.
In this example we will use JDBC connection to an Oracle database. For
the Oracle client we could choose Instant Client or the full
Installation, because, in our case, we will only need ojdbc14.jar to be
in the Glassfish /lib directory. But I strictly recommend installing the
full Oracle client, (Administrator), because there are a lot of helpful
utilities such as sqlplus, tnsping which can help resolve oracle (and
other) connectivity problems there. Also recommended is to install its
own version of JDK (as described in the remarks here:
This will help you have a nonchangeable environment to run the
application server. However it will add some system administration
overhead. But it will increase the reliability of our environment.
Installation process
- Install Oracle client
(below we assume the installation base
is in /opt/oracle and the installation of the client is in the
directory: /opt/oracle/product/10.2.0/client_1 and the version of Oracle
client is 10.2)
- Create a user to run our application server:
useradd -d /opt/Glassfish -k /etc/skel -m Glassfish
Of
course it is possible to run Glassfish as root, but for security
reasons, the separation of duties and privileges is strictly recommended
to run software under its own user. On the above command ignore the
error, related to the length of the user name.
- Download and extract JDK for example in /etc/Glassfish/java
- Download Glassfish software and put the archive in /opt
Do not forget to change ownership of the file and to remove it after installation
- Set the environment variables for Glassfish user:
JAVA_HOME=/opt/Glassfish/java
ORACLE_BASE=/opt/oracle
ORACLE_HOME=${ORACLE_BASE}/product/10.2.0/client_1
ORACLE_SID=ORCL
LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/lib:/usr/lib
CLASSPATH=${ORACLE_HOME}/jre:${ORACLE_HOME}/jlib:${ORACLE_HOME}/rdbms/jlib
ANT_HOME=/opt/Glassfish/lib/ant
PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:$PATH
export JAVA_HOME ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH CLASSPATH ANT_HOME PATH
- switch to Glassfish user
- run installation of Glassfish
java -Xmx256m -jar Glassfish-installer-v2-b58g.jar
(the name of Glassfish installation file is just an example, your may vary)
- go to Glassfish home directory
- add executable mode to ant
chmod -R +x lib/ant/bin
- run ant to accomplish configuration of Glassfish
lib/ant/bin/ant -f setup.xml
(if server will be in cluster instead of setup.xml use setup-cluster.xml)
- Voila! You have installed the Glassfish Java application server