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



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



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.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More