This post documents a set of environment variables for the setup of Liferay on a Linux OS. It illustrates the use of the ‘.bashrc’ file as well as the ‘.pam_environment’ approach. a Few extra variables are included from my particular software development platform because I’m using Groovy and Grail with STS.

#
# FileID:	.bashrc
# Author:	Stephen Davis
# Edition:	1330.24052013
# Purpose:	Set environment variables
#
# Maintenance history:
#
# 5/24/13, Created by S Davis.
# 7/24/13, Added alias command to startup and shutdown Tomcat. S Davis.
#
# Export environment variables
#
export ANT_HOME=/usr/share/ant/ant-1.9.1
export ANT_OPTS="-Xms256M -Xms512M"
export CATALINA_BASE=/var/lib/tomcat/tomcat-7.0.40
export CATALINA_HOME=/usr/share/tomcat/tomcat-7.0.40
export CATALINA_TMPDIR=/usr/share/tomcat/tomcat-7.0.40/temp
export CLASSPATH=.:/usr/local/sbin:/usr/lib/jvm/jdk1.7.0_17/jre/lib:/usr/lib/jvm/jdk1.7.0_17/lib:/usr/share/tomcat/tomcat-7.0.40/bin/bootstrap.jar:/usr/share/tomcat/tomcat-7.0.40/bin/juli.jar:/usr/share/tomcat/tomcat-7.0.40/lib:/usr/share/tomcat/tomcat-7.0.40tomcat-7.0.40/lib/ext
export GRAILS_HOME=/usr/share/grails/grails-2.2.1
export GROOVY_HOME=/usr/share/groovy/groovy-2.1.3
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_17/jre
export JAVA_JRE=/usr/lib/jvm/jdk1.7.0_17/jre
export PATH=${JAVA_HOME}/bin:${PATH}:${ANT_HOME}/bin:${GROOVY_HOME}/bin:${GRAILS}/bin
#
# Set the alias
alias cd_lrp="cd /var/lib/tomcat/plugins"
alias cd_lrpp="cd /var/lib/tomcat/plugins/portlets"
alias startup_tc="${CATALINA_HOME}/bin/startup.sh"
alias shutdown_tc="${CATALINA_HOME}/bin/shutdown.sh"
#

 

#
# FileID:	.pam_environment
# Author:	Stephen Davis
# Edition:	1630.11052013
# Purpose:	Set environment variables
#
# Notes:
#
# The syntax for this file is not the same as the standard found in bash.  Refer to online
# documentation for more information.
#
# Maintenance history:
#
# 5/9/13, Added the TOMCAT_HOME to accommodate the Liferay installation instructions. S Davis.
# 5/25/13, Updated path and ANT_HOME as well as added variables GRAILS_HOME and GROOVY_HOME. S Davis.
#
# Export environment variables
#
ANT_HOME	OVERRIDE=/usr/share/ant/ant-1.9.1
ANT_OPTS	OVERRIDE="-Xms256M -Xms512M"
CATALINA_BASE   OVERRIDE=/var/lib/tomcat/tomcat-7.0.40
CATALINA_HOME   OVERRIDE=/usr/share/tomcat/tomcat-7.0.40
CATALINA_TMPDIR OVERRIDE=/usr/share/tomcat/tomcat-7.0.40/temp
CLASSPATH 	OVERRIDE=.:/usr/local/sbin:/usr/lib/jvm/jdk1.7.0_17/jre/lib:/usr/lib/jvm/jdk1.7.0_17/lib:/usr/share/tomcat/tomcat-7.0.40/bin/bootstrap.jar:/usr/share/tomcat/tomcat-7.0.40/bin/juli.jar:/usr/share/tomcat/tomcat-7.0.40/lib:/usr/share/tomcat/tomcat-7.0.40tomcat-7.0.40/lib/ext
GRAILS_HOME	OVERRIDE=/usr/share/grails/grails-2.2.1
GROOVY_HOME	OVERRIDE=/usr/share/groovy/groovy-2.1.3
JAVA_HOME 	OVERRIDE=/usr/lib/jvm/jdk1.7.0_17/jre
JAVA_JRE 	OVERRIDE=/usr/lib/jvm/jdk1.7.0_17/jre
PATH 	        OVERRIDE=${JAVA_HOME}/bin:${PATH}:${ANT_HOME}/bin:${GRAILS_HOME}/bin:${GROOVY_HOME}/bin
#

Notes:

  1. You’ll notice I create a structure where releases of software packages are within a parent folder. This helps facilitate testing and debugging.
  2. For example, multiple versions of Apache Ant are on my development machine (versions 1.8.4 and 1.9.0). It is easy to switch between editions merely updating the variable. Many programmers use a similar approach.
  3. As of this post, I was using Spingsource’s STS GG as my IDE of choice. This won’t apply to others but I’ve kept it in for those who also need to setup an editor.
  4. A few alias have also been established for the convenience bringing the up / down the application server.
  5. There are extra directories in the PATH which won’t be relevant to you if you’re not an Groovy / Grails / android developer. You’re invited to ignore them.  🙂