Enterprise Collaboration with Liferay

From the Source

If you set up these tools from source, create a staging area for the code and installer binaries:

mkdir /opt/install

After obtaining the Apache http server source and mod_jk binary [1], place them in the new directory /opt/install. You can obtain Liferay 4.4.2 – bundled with Tomcat 5.5 and the SQL scripts bundle – from the Liferay website [2]. Also, you will need the Java 6 binary [3] and the MySQL Connector for Java [4] – be sure you get the right version! Check the MySQL version with mysql --version.

Next, create a directory for Liferay to reside in:

mkdir /opt/liferay-4.4.2

Then copy the Liferay bundle to the new directory and expand:

cp /opt/install/liferay-portal-tomcat-5.5-jdk5-4.4.2.zip /opt/liferay-4.4.2
cd /opt/liferay-4.4.2
unzip ./liferay-portal-tomcat-5.5-jdk5-4.4.2.zip
remove zip file: rm ./liferay-portal-tomcat-5.5-jdk5-4.4.2.zip

Create group apache and user tomcat as a member of Apache:

groupadd apache
useradd -g apache tomcat
make Tomcat startup scripts executable
chmod 755 /opt/liferay-4.4.2/bin/*.sh

Next, configure the database connection settings and mail server settings:

vi /opt/liferay-4.4.2/conf/Catalina/localhost/ROOT.xml

Edit the file so that it resembles the file in Listing 1. Note the username set earlier for the MySQL user lportal and the password in mysql config.

Listing 1

ROOT.xml

01 <Context path="" crossContext="true">
02         <!-- MySQL -->
03
04 <Resource
05                 name="jdbc/LiferayPool"
06                 auth="Container"
07                 type="javax.sql.DataSource"
08                 driverClassName="com.mysql.jdbc.Driver"
09                 url="jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8"
10                 username="lportal"
11                 password="FullMetalJacket"
12                 maxActive="20"
13         />
14
15         <!-- Mail -->
16
17         <Resource
18                 name="mail/MailSession"
19                 auth="Container"
20                 type="javax.mail.Session"
21                 mail.imap.host="localhost"
22                 mail.pop3.host="localhost"
23                 mail.smtp.host="smtp.gmail.com"
24                 mail.smtp.port="465"
25                 mail.smtp.auth="true"
26                 mail.smtp.starttls.enable="true"
27                 mail.smtp.user="accountname@googleappsdomain.com"
28                 password="emailpassword"
29                 mail.store.protocol="imap"
30                 mail.transport.protocol="smtp"
31                 mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
32         />
33
34         <!-- JAAS -->
35
36         <Realm
37                 className="org.apache.catalina.realm.JAASRealm"
38                 appName="PortalRealm"
39                 userClassNames="com.liferay.portal.security.jaas.PortalPrincipal"
40                 roleClassNames="com.liferay.portal.security.jaas.PortalRole"
41                 debug="99"
42                 useContextClassLoader="false"
43         />
44 </Context>

Now, untar and drop the MySQL Connector into /opt/liferay-4.4.2/lib/ext:

cd /opt/install
tar -zxvf ./mysql-connector-java-5.1.5.tar.gz
cd mysql-connector-java-5.1.5
cp ./mysql-connector-java-5.1.5-bin.jar /opt/liferay-4.4.2/common/lib/ext

(Your MySQL Connector file name may be different.) To populate the MySQL database, create a directory to expand the SQL scripts to and load the appropriate one into MySQL:

mkdir /opt/install/sql-scripts
mv /opt/install/liferay-portal-sql-4.4.2.zip /opt/install/sql-scripts
cd /opt/install/sql-scripts
unzip ./lilferay-portal-sql-4.4.2.zip
cd create-minimal
mysql lportal -u lportal -p < ./create-minimal-mysql.sql

This example uses the minimal install database script because this configuration doesn't require much cleanup before production deployment. In the folder named create, you will find scripts that will load up a richly populated instance of Liferay, much like the Liferay website. If you have time on your hands, you can load the database from that folder to explore an environment with users, groups, content, and communities already set up.

Starting Liferay

Change ownership of /opt/tomcat-4.4.2 to user tomcat, group apache:

chown -R tomcat:apache /opt/liferay-4.4.2

Create a startup script similar to the script showing in Listing 2.

Listing 2

/etc/init.d/liferay

01 #!/bin/sh
02 # Script for starting Liferay (Tomcat)
03 # chkconfig: - 60 61
04 # description: Tomcat-Liferay
05 export JAVA_HOME=/opt/tools/java/jdk1.6.0_02
06 export CATALINA_HOME=/opt/liferay-4.4.2
07 export TOMCAT_USER=tomcat
08 # You may want to set a different value for sleep.
09 # You want to make sure Tomcat has plenty of time to stop
10 # and release the port in case of restart
11 start() {
12         echo -n " Starting Liferay-Tomcat ..."
13         su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh
14         sleep 2
15 }
16 stop()  {
17         echo -n " Stopping Liferay-Tomcat ..."
18         su $TOMCAT_USER -c $CATALINA_HOME/bin/shutdown.sh
19         sleep 5
20 }
21 case "$1" in
22         start)
23                 start
24                 ;;
25         stop)
26                 stop
27                 ;;
28         restart)
29                 stop
30                 start
31                 ;;
32         *)
33         echo $"{start|stop|restart}"
34         exit
35 esac

Now, make the script executable, set up Liferay as a service, and test Liferay:

chmod 755 /etc/init.d/liferay
chkconfig --add liferay
chkconfig liferay on
service liferay start

Tail the output of the log file to see that Liferay starts up ok:

tail -f /opt/liferay-4.4.2/logs/catalina.out

Errors involving the MySQL driver or an inability to determine the dialect for MySQL could indicate an incorrect driver version. Verify the version of MySQL running on the server and the version of the MySQL driver you have installed. Also make sure that ownership for the connector is tomcat:apache.

Point your browser to http://{serverIpAddress}:8080 to test the configuration. You should see the default welcome page with a login prompt.

Looking Forward

Congratulations. You now have a working implementation of Liferay. Although it is still not production-ready, it is ready for you to dive in and familiarize yourself with the system. The next steps are to install the Apache http server and mod_jk Tomcat connector. Before building Apache, check out Liferay. Using the password test, log in with test@liferay.com, and then change the password on the test@liferay.com account by selecting My Account under the Welcome button in the upper right corner.

With the default setup, all new users get their own community. Users get a sort of sandbox, where they can place portlets and switch around screen layouts without affecting the public pages.

Now would be a great time to take a breather and peruse some of the Liferay online documentation at http://www.liferay.com/web/guest/community/documentation.

Read full article as PDF:

Liferay_CMS.pdf (649.84 kB)

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Liferay_CMS.pdf (649.84 kB)

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia