Global Open Versity IT Systems Integration Hands-on Labs Training Manual
Step by Step Install Guide Liferay Portal Enterprise on Linux
Kefa Rabah Global Open Versity, Vancouver Canada krabah@globalopenversity.org www.globalopenversity.org
Table of Contents
Page No.
STEP-BY-STEP INSTALL GUIDE LIFERAY PORTAL ENTERPRISE ON LINUX Part 1: Install JDK6 Part 2: Quick Liferay Portal Installation with Default HSQL Database Part 3: Install MySQL Database for Liferay Enterprise Step 1: Install and configure MySQL Database Server Part 4: Install Liferay for an Enterprise Step 1: Remove Default Bundled Sample Data Step 2: Create Portal.Ext.Properties File Part 5: Need More Training
Global Open Versity IT Systems Integration Hands-on Labs Training Manual
Step-by-Step Install Guide Liferay Portal Enterprise on Linux
By Kefa Rabah, krabah@globalopenversity.org Feb 09, 2010 SerengetiSys Labs
Project: your company – an enterprise business concern recently is deploying a new network infrastructure and they would like to include web portal to be used by their staff members and business partners – for this they have opted to go for Liferay Portal.
Liferay Portal is the world's leading enterprise open source portal framework using the latest in Java and Web 2.0 technologies. It offers integrated Web publishing and content management, an enterprise service bus and service-oriented architecture, and compatibility with all major IT infrastructures. (Liferay is trademark for Liferay Inc.) Liferay Portal is a Java/J2EE portal system that provides personalization (like Yahoo!), web email (like Hotmail), blogs (like Xanga), document library, CMS, message boards (like Jive), shopping (e-commerce), Wiki and many other web tools all available Liferay Inc. develops mainly one product: Liferay Portal. This portal is divided into three main products: • • • Liferay Portal - JSR-286 enterprise portal platform Liferay CMS - Content Management System (Changed to 'Liferay Web Content' after version 5.2) Liferay Collaboration Suite - Collaboration software (blogs, instant messaging, message boards, etc.)
Liferay Portal is available in two versions: • • Liferay Portal Enterprise Edition - the commercial offering that includes full support. Whilst more stable than SE it is generally a release or so behind Liferay Portal Standard Edition - the free version with the latest features and support through the active community
Liferay portal supports all major Java application servers, databases, and operating systems with over 100.000 deployment configurations worldwide. Liferay portal also supports internationalization (I18N) for any language out-of-the-box and ships with default translations for 22 languages. Gartner recognized Liferay as visionary leader in 2009 Magic Quadrant for Horizontal Portal Products. Why is it so popular? Because Liferay Portal has out-of-the-box all of the features you need to run a successful web site, whether that site is a public Internet site, a corporate Intranet, or anything in between. MySQL is the leading open source database, and is used widely for web application middleware environments. MySQL Enterprise Server software is the most reliable, secure and up-to-date version of MySQL for cost-effectively delivering E-commerce, Online Transaction Processing (OLTP), and multiterabyte Data Warehousing applications. It is a fully integrated transaction-safe, ACID compliant database 2
with full commit, rollback, crash recovery and row level locking capabilities. MySQL delivers the ease of use, scalability, and performance that has made MySQL the world's most popular open source database.
Solution:
In this Lab session, you’ll learn how to setup virtual network on VMware (you may also use any other virtual machines like MS VirtualPC, Linux Xen, or VirtualBox from Sun). Next you will learn how to install and setup Sun JDK6. You’ll also learn how to install & setup Liferay Portal bundled with Tomcat 6 Standard Edition. You’ll also learn how to extend the bundled installation to Liferay Portal Enterprise for full production ready system. Finally you’ll have an opportunity to do the Hands-on Labs home assignment labs to test what you have learned in this lesson. Once you’re done with this labs session you should have gained an experience and capability to enable you to plan design implement and deploy Liferay Portal for small to medium business infrastructure. Assumptions: 1. It’s assumed that you have a good understanding of Linux operating system and its working environment. It’s also assumed that you know how to install and configure Linux CentOS5, if not go ahead and pop over to scribd.com and check out a good howto entitled “Install Configure and Upgrade Linux CentOS5 Server v1.1” to get you started. 2. It’s also assumed that you have a good understanding of MySQL database.
Part 1: Install JDK6
1. To download Java SE SDK 6, just go to http://java.sun.com/javase/downloads/index.jsp, and follow the instructions to download a file called: jdk-6u18-linux-i586.bin, at the time of writing. Save it under the /usr/java directory. You may have to create the java directory if it’s not there. 2. To install Java SE SDK, just type the following commands in /usr/java directory. # chmod +x jdk-6u18-linux-i586.bin #./jdk-6u18-linux-i586.bin • • • Read and accept the license for the installation to start. When done, "Press Enter to Continue..." You can go ahead and register your installation with Sun if you so desired.
3. To verify that JDK6 is installed correctly in /usr/java/jdk1.6.0_18 directory, type the following command: #/usr/java/jdk1.6.0_18/bin/java -version 4. Now using your favorite Text editor, insert the following lines inside /etc/profile for both JDK6 and Liferay Portal.
export JAVA_HOME=/usr/java/jdk1.6.0_18 export LIFERAY_HOME=/usr/liferay/liferay-portal-5.2.3/tomcat-6.0.18 export PATH=$JAVA_HOME/bin:$LIFERAY_HOME/bin:$PATH 5. You’re done with JDK6 setup. 6. Before we begin, we will need to ensure that JAVA_HOME and LIFERAY_HOME environment are correctly set. To do this, open a new terminal and type the following commands: # echo $JAVA_HOME # echo $LIFERAY_HOME 7. You’re done with JDK6 installation and setup.
Part 2: Quick Liferay Portal Installation with Default HSQL Database
In this section we’ll install the bundled Liferay Portal SE in your local machine. To do this, perform the following procedures: 1. Hope over and download the Liferay Portal Bundled with Tomcat JDK6 from Liferay official Sourceforge website (http://sourceforge.net/projects/lportal/). 2. Download a file called: liferay-portal-tomcat-6.0-5.2.3.zip at the time of writing this article. Save it in the /usr/liferay directory. You may have to create the liferay directory if it’s not there. 3. Change to /usr/liferay directory and unzip the bundled file.
4. If everything is fine, you can start Liferay Portal with the following command. # $LIFERAY_HOME/bin/startup.sh
Note 1: since we have setup Liferay home environment you may simply start it by issuing the "startup.sh " command, see Fig. 1. Note 2: for Windows run "$TOMCAT/bin/startup.bat".
5. To verify that the Tomcat installation is complete, open a Web browser, and type in following URL: http://<YOUR_LIFERAY _IP>:8080, DNS, or you can also simply use http://localhost:8080. If everything is fine, you should be able to see a web page such as one shown in Fig. 2. You may be automatically taken to the Liferay Portal’s home page.
Fig. 2: Bundled Liferay Portal default home page
6. Click the Welcome button and then select Sign in 7. Log in as an administrator using the following data Email Address: "bruno@7cogs.com" and Password: "bruno", without the quotes. Note current users are listed on the right side column of the home page not visible on Fig. 2.
8. When done, you can stop Liferay Portal with the following command. # $LIFERAY_HOME/bin/shutdown.sh
Note 1: since we have setup Liferay home environment you may also simply stop it by issuing the "shutodwn.sh " command, see Fig. 3.
9. Congratulations! You now have a running copy of Liferay. Warning: Note that the bundle comes with an embedded HSQL database loaded with sample data from the public website of Liferay. Do not use the Hypersonic in production. Note 1: Liferay can be configured to use many different databases. In the next section we will change form using the default database (Hypersonic) of the Liferay-Tomcat bundle to instead point to a MySQL database. Note 2: As you can see, bundles are the easiest way to get started with Liferay. They come preconfigured with a running Liferay that can be used immediately to explore all of the things that Liferay can do. And with minimal extra configuration, as we’ll see later, bundles can be converted into full enterprise production-ready systems. Note 3: However, first before we can revert from Bundled Liferay to Liferay Enterprise, we need to install a production database. In our case we have opted to use the open source MySQL database.
Part 3: Install MySQL Database for Liferay Enterprise
MySQL is the leading open source database, and is used widely for web application middleware environments. MySQL stores relational data and enables fast, simple access and updates to stored data through the standard JDBC APIs. These APIs are supplied by MySQL in the form of the Connector/J software.
IMPORTANT! Set up the mysql database root password. Without a password, ANY user on the box can login to mysql as database root. The mysql root account is a separate password from the machine root account. To do this, run: # /usr/bin/mysql_secure_installation Note: This will give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. 3. If the database used in the Tomcat data source does not exist, create the database by entering the following command: # mysql -u root –p 4. Create a database in MySQL called "lportal" (or change as desired) – DO NOT create any tables on it (Liferay will do that). mysql> CREATE DATABASE lportal DEFAULT CHARACTER SET utf8; mysql> GRANT ALL ON lportal.* TO 'lpuser'@'localhost' \ ->IDENTIFIED BY 'lpass' WITH GRANT OPTION; mysql> GRANT ALL ON lportal.* TO 'lpuser'@'localhost.localdomain' ->IDENTIFIED BY 'lpass' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> QUIT;
\
5. Now check and verify that the "lportal" database was created and is empty of tables, see Fig. 4.
Fig. 4: Verifying lportal database is created with empty tables.
6. You’re done with MySQL lportal database creation.
enterprises will have an established Java EE infrastructure upon which they would eventual use to install Liferay. In this situation, a bundle will not suffice. Here, however, we’ll focus on installing Liferay onto an already-established bundled installed application server.
Step 1: Remove Default Bundled Sample Data Recall that installing Bundled Liferay Portal by default installs the sample data i.e., 7 cogs data. Although, the sample 7 Cogs data does provide you with a good example of how Liferay might be used, however, when you are ready to build your own site, you would not want that data cluttering up your database. Therefore, before you connect Liferay to your production database – in our case MySQL database, which we just installed above – then you will want to make sure you have removed the sample 7 Cogs data from your Liferay installation. This is as simple as undeploying the included 7 Cogs applications from the bundle. There are three applications included in the bundle that we’ll need to remove, these are: • • • sevencogs-hook sevencogs-theme wol-portlet
To do this, change to $LIFERAY_HOME/webapps directory, and remove the three directories. Note 1: These three modify Liferay's default behavior in order to make the 7 Cogs application work properly. Because we want to revert Liferay's behavior back to its defaults for a clean install, you will want to remove: Note 2: If you forget to undeploy these three applications before you connect Liferay to your real database, the sample data will be created in your database and may cause issues, especially if you already have data in your database. Hence, you want to make sure that you get these three applications undeployed before setting up your server. Use your application server's method for undeploying applications in order to remove them.
Step 2: Create Portal.Ext.Properties File Now we need to create the portal-ext.properties file to link our new production MySQL database to Liferay. Next, to setup Liferay on MySQL perform the following procedure: 7. Create portal-ext.properties file in /webapps/ROOT/WEB-INF/classes and in it add your properties content. In our case its as shown below:
# # MySQL # jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEn coding=UTF-8&useFastDateParsing=false jdbc.default.username=lpuser jdbc.default.password=lpass schema.run.enabled=true schema.run.minimal=true Note 1: • The first line specifies the MySQL driver • The second identifies the URL for MySQL and the database name "lportal", as was created in Step 1 above. • The third line is the dbase user name (Changes as desired). • The fourth line is the dbase password (Change as desired). • The final two lines create the database tables and populate them with minimal data. Note 2: That is all you need to do. You will know if it worked when you startup Liferay and you see "MySQL dialect" line during boot. the bootup will also pause and tell you it's creating the schema and populating it with data. 8. Figure 5, also confirms that our MySQL lportal database tables is indeed populated.
Fig. 5: Verifying lportal database is created with tables populated.
10. Open your browser and go to http://localhost:8080 (here we assume that it is a local installation, otherwise use the real host name or IP). Note: you may be automatically taken to Liferay default web portal home page! 11. From the right-hand corner, click the Welcome button, as shown in Fig. 6.
Fig. 6
12. Next, login as an administrator User: "test@liferay.com" and Password: "test". Answer the test question for password reminder, and you should then be logged in the Liferay default home page. Note: The default account you logged in with has Admin rights to the portal so you are now in complete control to use and customize the portal anyway you like. The rest of this Hands-on will outline some of the basic features and functionality of the Liferay portal. 13. Once you login as the administrative user, you will see that little has changed, as can be seen in Fig. 7. Note "Test Test" is the full name of the "test" user. 14. Go ahead and take your time to familiarize yourself with some of the Administrative links, as follows: • • • • • • • Home: takes you to the home page. Control Panel: takes you to the administrative functions of Liferay. My Account: lets you edit your user information. Sign Out: logs you out of the portal. Add Application: opens the Add Application window which allows you to add portlets to the page. Layout Template: displays the Layout Template window which allows you to choose different layouts for the page. Manage Pages: takes you to the page administration screen, where you can add and delete pages, change the order of the pages, and configure several other things about pages. Toggle Edit Controls: This will let you turn on and off the edit Fig. 7: Welcome Dock controls in the top of the portlet windows. This is helpful for administrators who want to look at a page they're working on and see it the way a regular user would. My Places: shows you the community and organization pages in the portal to Liferay's which you can navigate.
Break time
We’ll take a break and continue later to configure. Stay tuned as I’ll continue to add more info and hands-on labs!
Part 5: Need More Training
Are you having trouble understanding or comprehending the working of Linux OS or Windows or any other IT solutions, business and database, if so, then check out some of our introductory and advance courses at: Global Open Versity, Vancouver Canada.
Enjoy!
----------------------------------------------Kefa Rabah is the Founder and CIO, of Serengeti Systems Group Inc. Kefa is knowledgeable in several fields of Science & Technology, IT Security Compliance and Project Management, and Renewable Energy Systems. He is also the founder of Global Open Versity, a place to enhance your educating and career goals using the latest innovations and technologies.
ICT202 - Linux Enterprise Infrastructure Engineering Diploma This is an advance Linux course for IT professionals, Network Infrastructure Engineers in enterprise business information technology (IT) strategy & development. The goal of this course is to equip students and IT professionals with advance Linux skills required in enterprise infrastructure planning, design, development, implementation and deploying complex network infrastructure. In this course you will learn how to install and configure Linux OS. Design & implement a DNS master & slave servers for redundancy. Deploy virtual domains suitable for ISP solution. Configure DHCP server; Deploy network defense security appliances and Firewall solutions. Design & Install & Deploy Secure Apache Tomcat AS. Design & Implement OpenLDAP or OpenDS infrastructure for Single-Sign-On (SSO). Deploy Sendmail, Postfix & Zimbra messaging systems. Install Email clients Thunderbird & Evolution. Deploy JBoss & JPortal infrastructure, Liferay Portal Enterprise. Integrate Samba with Windows Active Directory & Mac OSX infrastructure for SSO. GlassFish & SAML on Linux, Deploy Moodle LMS. Deploy SugarCRM. Upon completion of this course you will have gained advance knowledge and skills at expert competency with capability to deploy complete medium enterprise level network infrastructure solution. Or start your own ISP business or Linux consultancy services. PREQ: BM103, BM200, CIS102, CIS105, CIS107, CIS200, CIS202/CIS402, & CIS204.Donate and help others bridge the digital divide
Enhancing experiential education to all through eLearning in the 21st Century