Installing Liferay-Tomcat bundle as a Windows Service

Hi

Here I will explain you how to install Liferay6.1(Tomcat bundle) as a Windows Service.

Assumptions:

  1. You already have the liferay 6.1 bundle downloaded (If not, download it from here).
  2. You already have a Tomcat7 server (windows zip) downloaded  (If not, download it from here).

Procedure:

  • Extract your liferay bundle and tomcat to any chosen location.

  • Copy tomcat7.exe  and tomcat7w.exe from tomcat to your liferay-portal and rename them to liferay61 and liferay61w respectively (If you wish them not to rename then leave them as is).

  • Create liferay-windows-service.bat in liferay-portal/tomcat/bin directory and copy the below content to that file
@ECHO OFF
CLS
@ECHO Liferay windows service - Instalation Script
@ECHO *

@SET "SERVICE_NAME=Liferay61"
@SET "SERVICE_DISPLAY_NAME=Liferay Portal 6.1 CE"
@SET "SERVICE_DESCRIPTION=Starts Liferay Portal 6.1 CE"

@SET "TOMCAT_DIR=D:\liferay\liferay-portal-6.1.0-ce-ga1\tomcat-7.0.23"

@SET "JRE_PATH=D:\liferay\liferay-portal-6.1.0-ce-ga1\tomcat-7.0.23\jre1.6.0_20\win"
@SET "INITIAL_MEMORY=512"
@SET "MAXIMUM_MEMORY=1024"

@ECHO *
@ECHO Setting variables ...
@ECHO JRE_PATH=%JRE_PATH%
@ECHO TOMCAT_DIR=%TOMCAT_DIR%
@ECHO INITIAL_MEMORY=%INITIAL_MEMORY%
@ECHO MAXIMUM_MEMORY=%MAXIMUM_MEMORY%
@ECHO *

@ECHO ON
@ECHO Executting command ...

liferay61.exe //IS//%SERVICE_NAME% --DisplayName="%SERVICE_DISPLAY_NAME%" --Description="%SERVICE_DESCRIPTION%" --Install="%TOMCAT_DIR%\bin\liferay61.exe" --Jvm="%JRE_PATH%\bin\server\jvm.dll" --JvmMs="%INITIAL_MEMORY%" --JvmMx="%MAXIMUM_MEMORY%" --Classpath="%TOMCAT_DIR%\bin\bootstrap.jar;%TOMCAT_DIR%\bin\tomcat-juli.jar" --StartMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StartPath=%TOMCAT_DIR% --StopMode=jvm --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop --StopPath=%TOMCAT_DIR% --LogPath="%TOMCAT_DIR%\logs" --StdOutput="%TOMCAT_DIR%\logs\stdout.log" --StdError="%TOMCAT_DIR%\logs\stderr.log" --JvmOptions="-XX:MaxPermSize=256m;-Dfile.encoding=UTF8;-Djava.net.preferIPv4Stack=true;-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false;-Duser.timezone=GMT;-Djava.io.tmpdir=%TOMCAT_DIR%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%TOMCAT_DIR%\conf\logging.properties;-Dcatalina.home=%TOMCAT_DIR%;-Dcatalina.base=%TOMCAT_DIR%;-Djava.endorsed.dirs=%TOMCAT_DIR%\endorsed"

  • Edit the file according to your requirements and run it.

  • Congratulations you have successfully installed Liferay 6.1 as a windows service

  • Run liferay61w to configure any settings.