четверг, 18 июля 2013 г.

Install LifeRay 6.1 on Ubuntu and CentOS

Today i will install LifeRay 6.1 GA2 on Ubuntu 13.04 with 1Gb memory.

1. Installing.
At first create new user for Liferay:

sudo adduser --home /home/liferay liferay
Install Java:

sudo apt-get install default-jre
For me it was installed into /usr/lib/jvm/java-7-openjdk-amd64
On CentOS path was:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64
Get a LifeRay:

http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.1.1%20GA2/liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip
unzip liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip -d /home/liferay
Change user to liferay and go to Liferay folder. There i have a problem becouse when i try to start Tomcat it was not work. So all operations i do as administrator.

2. Tomcat configuration.
How we need to set JAVA_HOME variable. And we do it in bash. Go to file /etc/bash.bashrc and add:

JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
For CentOS JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre
Next you need give a permissions to Tomcat log file. Only heavy artillery helps me:

chmod 777 /home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/logs/catalina.out
Okey, now you can start LifeRay

sh /home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/startup.sh
In console you'll get list of variables. And when in catalina.log appears line
INFO: Server startup in 24802 ms
server is start.

3. Add Liferay in autoload
At first create script /etc/init.d/liferay6

#!/bin/bash
# LifeRay Startup Service script v1.0 by Faraz Haider 6 May 2012
# acts as startup service script for LifeRay Portal.
# USAGE: start|stop|status|logs
#
case "$1" in
start)
echo "Starting LifeRay Web Portal."
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
/home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/startup.sh
;;
stop)
echo "Stopping LifeRay Web Portal."
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
/home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/shutdown.sh
;;
logs)
echo "See the logs of the LifeRay Web Portal."
tail -f /home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/logs/catalina.out
;;
status)
# Check to see if the process is running
ps aux|grep -i liferay
;;
 
*)
echo “LifeRay Web Portal Service”
echo $”Usage: $0 {start|stop|status|logs}”
exit 1
esac
exit 0
For CentOS:

#!/bin/bash
# chkconfig: 2345 90 10
# description: Liferay Service
# LifeRay Startup Service script v1.0 by Faraz Haider 6 May 2012
# acts as startup service script for LifeRay Portal.
# USAGE: start|stop|status|logs
#
case "$1" in
start)
echo "Starting LifeRay Web Portal."
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre
#export JRE_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
/home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/startup.sh
;;
stop)
echo "Stopping LifeRay Web Portal."
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre
#export JRE_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
/home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/bin/shutdown.sh
;;
logs)
echo "See the logs of the LifeRay Web Portal."
tail -f /home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/logs/catalina.out
;;
status)
# Check to see if the process is running
ps aux|grep -i liferay
;;
 
*)
echo “LifeRay Web Portal Service”
echo $”Usage: $0 {start|stop|status|logs}”
exit 1
esac
exit 0
First two comments real important.
Make file executable:

chmod 755 /etc/init.d/liferay6
update-rc.d tomcat7 defaults
For CentOS:
chmod 755 /etc/init.d/liferay6
chkconfig liferay6 on

PS: only start,stop and status works
Reboot and be happy.

Change Tomcat port

Default port is 8080 but in not prety good becouse link www.example.com:8080 looks like a hell.
So go to home/liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/conf/server.xml. Find part:

 
And change port 8080 to what you want. I use 80 port for my site address www.example.com.

Комментариев нет:

Отправить комментарий