Environment:Windows, Tomcat Server and Liferay 6.2CE with Eclipse
Note:
I have used windows 7 operating system .You can apply the same steps to any environment but the only change is in setting the environment variables and downloading software’s based on OS. Remaining all are same for any operating system.
Required Steps
- Install JDK and setting required environment variables (JAVA_HOME, path)
- Download MySQLserver and Start MySQL server
- Download HeidiSQLand install (Optional)
- Connecting to MySQLserver and create Database for Liferay
- Download Liferay 6.2 Tomcat Bundles
- Download Liferay 6.2 Plugins SDK
- Download Liferay IDE with Eclipse
- Create Work space folder and Extract the downloaded files in work space directory.
- Change the name of tomcat liferay bundle to only bundles
- Configure database setting in portal-ext.properties file and place properties file in Liferay Home (bundles) directory.
- Configure Liferay Tomcat sever information in Plugins SDK properties file.
- Start Eclipse and configure liferay prospective
- Configure Plugins SDK in Eclipse
- Configure Liferay Tomcat Server in Eclipse
- Start Tomcat from Eclipse and access liferay portal
- Complete required basic configurations for liferay portal (This is only for first time)
- Start Liferay Application Development
Install JDK and setting required environment variables (JAVA_HOME, path)
We need to install JDK in our system and we need to set java path environment variables
Download java SDK 1.6 from following location and install JDK in your machine. Follow the installation steps when you install JDK.
Setting required environment variables
Go to your computer properties
Accessing System Environment variables from following screen.
Creating JAVA_HOMEvariable as follows
Variable Name: JAVA_HOME
Variable Value: The path where your java installed means JDK home directory
The following screen shows you creating JAVA_HOME
Edit system path variable and specify the java path
In the existed system path variable add java path value (%JAVA_HOME%/bin)
In the System variables block you can see path variable, select path variable and click on edit button.
Add java path as follows
Once click on edit in variable value you can see existed path variable.
You can add ;%JAVA_HONE%/bin; to existed path value. Here each value is separated by semicolon.
This specify the java path which will used by java applications and servers.
The following diagram shows edit the system path variable
Download MySQL server and Start MySQL server
Download MySQLsever 5.1 from following location
Extract the zip file in your desired drive
Start MySQL database server
Open command prompt and go MySQL bin directory (mysql-5.1.70-winx64/bin) then use following command to start MySQL database server
mysqld --console |
Example:
The following is command prompt it start server and I am showing last line which indicate data base server started successfully.
Download HeidiSQL and install
Download HeidiSQL to access MySQL server databases. This is very good user interface to access database and modifies the data base tables.
Download HeidiSQL from following location
The following screen shows you download page of HeidiSQL
Double click on exe file and follow the installation steps to complete the successful installation.
HeidiSQLis data base browser we can manage database. Its very light weight and user friendly.
Connecting to MySQL server and create Database for Liferay
We can do this in two ways
- Connecting MySQLfrom HeidiSQLand create Liferay Data base
- Connecting to MySQLfrom MS DOS command prompt and create data base for liferay
Connecting MySQL from HeidiSQLand create Liferay Data base
Once successful installation of HeidiSQL, go to windows start and click on HeidiSQL
In Login window enter following details and connect to MySQL server
Click on New and enter the following details
Host Name: 127.0.0.1 OR localhost
User: root
Password: nothing it’s empty
The following screen MySQL server login from HeidiSQL
Once you successfully login you can see databases view as follows
The following screen shows the HeidiSQL view
Create lportaldatabase for Lifera portal. Right click on root node and select create new database
Enter database name lportal and click on Ok then database will be created
Connecting to MySQL from MS DOS command prompt and create data base for liferay
This is another way to connecting to MySQLserver with windows command prompt
Open MS Dos command prompt from your system
Go to MySQL server bin directory from command prompt and enter following command and press enter
It will ask password no need to enter password (because our password is empty) and again press enter
mysql -u root –p |
The following screen shows you admin login into MySQL server
Now create data base using following command and press enter then loprtal data base will be created.
create database lportal; |
Note:
Don’t forget semicolon end of the command
The following screen shows admin login in MySQL server and lportal database creation.
Download Liferay 6.2 Tomcat bundle
Download Liferay 6.2 Tomcat bundle from following location
The following screen is download page in website
Download Liferay 6.2 Plugins SDK
Download Plugins SDK from following location
Go to Liferay Portal 6.2 Community Edition section and from dropdown select Plugins SDK and download.
The following screen is Plugins SDK download page in liferay website.
Download Liferay IDE with Eclipse from following location
The following screen is Liferay IDE download page
Create Liferay Work Space and copy all Zip files to this location
Create one directory in your system and name of directory is your choice.
Assume we have created Liferay Work Space inD drive (D: / Liferay Work Space)
Once all Zip files downloaded and place all files in Liferay Work Space folder and extract all zip files in same location (use extract here from WinZip or WinRAR)
We can see following files in Liferay Work Space after extraction of all ZIP files.
liferay-plugins-sdk-6.2.0, eclipse liferay-portal-tomcat-6.2.0-ce-rc4 |
Note:
Based downloaded versions some time folder name may be changed but we can easily identify the Liferay Portal and Plugins SDK.
The following screen shows all zip files and extract the zip files in same location
Change the name of Liferay Tomcat Bundles directory to only bundles
Once we extract the liferay 6.2 tomcat bundles change the name of directory to bundles this is only for development convenience.
Actual liferay 6.2 tomcat bundles name as follows
Now change the name to bundles
The following screen shows after change name to bundles.
Configure database setting in portal-ext.propertiesfile and place properties file in Liferay Home (bundles) directory
Now bundles directory called as Liferay Home directory or we can say the directory which contains tomcat server is called Liferay Homedirectory .Inside bundles directory we can see tomcat server.
The files in bundles directory/Liferay Home as follows
Create one file called portal-ext.propertiesfile in Lifeay Home/bundlesDirectory and add following MYSQL data base configurations.
jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost:3306/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.default.username=root jdbc.default.password= |
Note:
Here our data base name is lportal already we created in previous step. You can create any database name of your choice but you need specify in portal-ext.properties file.
The following screen shows you portal-ext.propertiesfile in Liferay Home directory
Configure Liferay server information in Plugins SDK properties file
Go to liferay-plugins-sdk-6.2.0 in the Liferay Work Space and copy build.properties file and past in same location (clone the build.propertis file).
The following screen is after clone the build.properties
And change the copied build.propertis file name to build.SystemUserName.properties
Example:
How to find system user?
Go to your windows installation directory and find Users directory and you can see all system users. We need current login user.
The following screen shows available user in system
Now find the current user and change copied build.properties file name to build.SystemUserName.properties
In my case my users name is E5410
So my properties file is build.E5410.properties
The following screen shows you system user name build properties file and build.properties file
Now open newly created build.SysteUserName.properties file in any editor and configure server information as follows.
Uncomment following line in the opened properties file (remove # symbol start of lines)
app.server.type=tomcat app.server.parent.dir=${sdk.dir}/../bundles app.server.tomcat.dir=${app.server.parent.dir}/tomcat-7.0.42 app.server.tomcat.deploy.dir=${app.server.tomcat.dir}/webapps app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext app.server.tomcat.portal.dir=${app.server.tomcat.dir}/webapps/ROOT |
Make sure app.server.typeand app.server.dir properties should be correct
Note:
By default Plugins SDK build.properties file configured to Tomcat server so we need not to change anything in build.SystemUserName.propertis(buil.E5410.properties)file when we use liferay tomcat bundle. Moreover configuration in properties file set to tomcat server so nothing we change in properties file but you can cross check the things as I said above.
The following is example for app server directory that is tomcat server which is in bundles directory.
Start Eclipse and configure liferay prospective
Go to eclipse directory and double click on eclipse.exe it will take few min for ready to available.
The following screen shows eclipse exe file in eclipse directory which in Liferay Work Space.
Once liferay started it will ask you the work space then select our Liferay Work Spacedirectory (we already created this directory)
The following screen shows select the Work Space for eclipse
Once eclipse stared you can see Liferay IDE supported icons in eclipse because we already downloaded the eclipse which is integrated with liferay development support.
The following screen shows the liferay support icons.
Now change eclipse prospective to liferay
Click on add prospective icon and add liferay (which right side top corner)
Now we are in liferay prospective
The following screen showed us, we are in Liferay Prospective.
Configure liferay Plugins SDK to eclipse
Go to windows menu and click on preferences
Select Liferay in preferences and click on Installed Plugin SDKs
The following screen shows preferenceswindow and Installed Plugin SDK
Now add your Plugins SDK directory (which is in Liferay Work Space folder)
Click on add button and browse liferay Plugins SDK which in Liferay Work Space and then click on ok button
The following screen shows configure the Plugins SDK
Once you browse the Plugins SDK and select never radio button and click on ok button then it will be finished.
Updating build properties file before SDK used, this you can make never so that it won’t ask you next time. Because we already done configuration in SystemUserName.build.properties file so we need not update for each time.
Now we configured Plugins SDK to eclipse. Now select the configured SDK and click on OK button. (We can configure many Plugins SDK to eclipse but we need check at least one to use in development)
The following screen showed us select the Plugins SDK.
Configure Liferay Tomcat Server in Eclipse
Now we need to configure tomcat server to eclipse
Go to windows preferences in eclipse and select servers and then click on Rune Time Environments as follows.
Add our liferay tomcat server (which is in bundles directory)
Click on add and select Liferay INC Tomcat7 select and click check box(Create a new local server) then click on next.
Now browse tomcat server home location which is Liferay Work Space/bundles/tomcat7X
Note:
Tomcat Server Home directory nothing but in directory structure up to Tomacat7X folder (D:\Liferay Work Space\bundles\tomcat-7.0.40)
The following screen showed us tomcat home directory
Now select Run time JRE
Eclipse already has default JRE and Liferay Tomcat have another JRE apart from that we can also select our installed JRE (we already installed JDK/java in our system)
The following screen shows available JRE for tomcat server we can select any one or we can configure new JRE which is installed in system.
I suggest you select JDK or JRE which is installed in our system (Genaally you can see java installation in C:\Program Files\Java\jdk1.6.0_43 this called Java Home)
Click on installed JRE button and click on add button and select StandardVMand click on next.
Browse JDK (java installation directory) home directory (C:\Program Files\Java\jdk1.6.0_43), give any name for JRE Name text box (that’s your choice) and then click on finish
Now select our JRE from choices and click on ok then your eclipse and all configures servers use this JRE.
Now our configured JRE can see in dropdown list.
Select our JRE to liferay tomcat server as follows and click on finish button.
Select configured liferay tomcat server and click on OK
Now eclipse ready with Plugins SDK and Tomcat server for Liferay development
Once you finish all above steps then you can see eclipse in Liferay Prospective as follows.
We can different sections in eclipse.
Package explorer view:
We can see all projects and its packages and files directory structure
Servers View:
We can see all configured servers for eclipse now we already configure liferay tomcat servers. This you can see lifer side bottom.
Ant View:
Ant view used to display ANT build files of applications and we can run all ANT (compile, deploy) targets from this section. This you can see in top right.
Console View:
Console view for display server log information and build log information. This we can see middle bottom.
File Editor View:
This is used for edit file and writing code. We can see major section in middle.
Start Tomcat from Eclipse and access liferay portal
Go to eclipse servers view which you can see bottom left, there you can find Tomcat server. Right click on tomcat server and click on start.
Then server will be started. After few second it will show server started up message in console.
The following screen shows to start tomcat server in eclipse
In the eclipse console view you can see server startup message as follows.
The following screen shows tomcat server start up message it means server started successfully.
Access Liferay Portal
Use following URL in browser address bar to access liferay portal
Note:
Tomcat server default port is 8080 make sure no other application should not run in same port otherwise you can see address bind exception in console.
Complete required basic configurations for liferay portal (This only for first time)
After you access the liferay portal it will ask the some basic configuration details like administrator name, email, and password and remainder question.
You need accept some terms and conditions page then you finished the all steps
For complete detailed information you can go through following URL and read final step..
Note:
This is only for first time when we start server or when we access liferay portal.
Start Liferay Application Development
Now we have completed liferay development environment setup and we can start liferay application development.
I will explain liferay application development in the next post. The following are key development areas in liferay.
Plug-in portlet development
Hook Development
Layout development
Theme Development
Ext Development
Note:
In this article we have used Liferay IDE 1.6 that is why when we configure Liferay Run time server it show Liferay 6.1(Tomcat 7) server but it wont be any problem you can choose that it will work for Liferay 6.2
Liferay IDE 2.X on words we can see Liferay 6.2 (Tomcat 7) Server Run time environment when configure server.
we have more features in Liferay IDE 2.x we can develop and deploy portlet using ANT build and the same we can do it by MAVEN build .these features we can see in Liferay IDE 2.x version.
In this article we have used Liferay IDE 1.6 that is why when we configure Liferay Run time server it show Liferay 6.1(Tomcat 7) server but it wont be any problem you can choose that it will work for Liferay 6.2
Liferay IDE 2.X on words we can see Liferay 6.2 (Tomcat 7) Server Run time environment when configure server.
we have more features in Liferay IDE 2.x we can develop and deploy portlet using ANT build and the same we can do it by MAVEN build .these features we can see in Liferay IDE 2.x version.
Author
Meera Prince
0 comments:
Post a Comment