We will explain how to install Liferay 6.0.5 CE WAR bundle in an existing Apache Tomcat 6.0.29 and MySQL Server as non ROOT webapp and without Tomcat Manager.

1. Download and install Apache Tomcat 6.0.29 standard bundle (with Tomcat Manager included).

2. Copy %TOMCAT_HOME%/webapps/ROOT folder to %TOMCAT_HOME%/webapps/liferay605 folder.

3. Download liferay-portal-6.0.5.war and liferay-portal-dependencies-6.0.5.zip

4. Unzip WAR file and copy all content into %TOMCAT_HOME%/webapps/liferay605 folder.

5. Unzip and copy all dependencies to %TOMCAT_HOME%/lib

6. Download and copy 02 extra libraries (jta.jar and mail.jar) to %TOMCAT_HOME%/lib

7. Create liferay605.xml file into %TOMCAT_HOME%/conf/Catalina/localhost folder. It looks like this:

<Context path="" crossContext="true">
	<Resource
	name="jdbc/LiferayPool"
	auth="Container"
	type="javax.sql.DataSource"
	driverClassName="com.mysql.jdbc.Driver"
	url="jdbc:mysql://localhost:3306/lportal605_db?useUnicode=true&amp;characterEncoding=UTF-8"
	username="root"
	password=""
	maxActive="20"
	/>	
</Context>

In my case, DB user is “root” with empty password. You must create an empty DB in MySQL, for example “lportal605_db”.

8. Create portal-ext.properties into %TOMCAT_HOME%/webapps/liferay605 folder. It looks like this:

jdbc.default.jndi.name=jdbc/LiferayPool
portal.ctx=/liferay605

9. If you are using MySQL as database server instead of HSQL, you must copy mysql jdbc lib into %TOMCAT_HOME%/lib folder.

10. Add the code “

set JAVA_OPTS=%JAVA_OPTS% -Xmx1024m -XX:MaxPermSize=256m

” in the %TOMCAT_HOME%/lib/bin/startup.bat or startup.sh

11. Run startup.bat/sh, you will see in console when liferay creates and populates the portal database automatically. Now, you can open browser window and enter the folow URL http://localhost:8080/liferay605. Use “test@liferay.com” and “test” as user and password respectively.

Configure Tomcat Manager

Sometimes you need to deploy liferay in your favorite hosting provider but It is impossible because you can not change files of root context, in this case you can use only control panel of you ISP o Tomcat Manager.

Tomcat Manager is included in standard Tomcat bundle but by default It is disabled. If you want to enable it, follow the next steps:

1. Edit %TOMCAT_HOME%/conf/tomcat-users.xml

2. Add user, for example:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="manager"/>
<user username="roger" password="roger" roles="tomcat,manager"/>
</tomcat-users>

3. Run Tomcat and go to http://localhost:8080/manager

4. Enter user and password configured in step 2.

5. Log in to Liferay for example; in Tomcat Manager now you can see an opened session in liferay605 webapp context and to explore values stored in current session.

6. End.

References:

* Installing 5.2 SP3 WAR on Tomcat 6

* Execute Liferay Portal on non ROOT context

First, install VNC in CentOS:

[root@svdapp95 ~]# yum  --nogpgcheck install vnc

1. Create another user:

[root@svdapp95 ~]# useradd roger
[root@svdapp95 ~]# su - roger
[roger@svdapp95 ~]$ vncpasswd
Password:
Verify:
[roger@svdapp95 ~]$ cd .vnc
[roger@svdapp95 .vnc]$ ll
total 8
-rw------- 1 roger roger 8 Aug  6 17:04 passwd

2. Create vnc password for root too:

[root@svdapp95 ~]# vncpasswd
Password:
Verify:
[root@svdapp95 ~]# ls -la
[...]
[root@svdapp95 ~]# cd .vnc/
[root@svdapp95 .vnc]# ll
total 8
-rw------- 1 root root 8 Aug  6 16:45 passwd
[root@svdapp95 .vnc]#

3. Edit configuration of VNC server:

[root@svdapp95 ~]# nano /etc/sysconfig/vncservers
VNCSERVERS="1:roger 2:root"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x800"

4. Create xstartup script with root:

[root@svdapp95 .vnc]# /sbin/service vncserver start
Starting VNC server: 1:roger xauth:  creating new authority file /home/roger/.Xauthority

New 'svdapp95:1 (roger)' desktop is svdapp95:1

Creating default startup script /home/roger/.vnc/xstartup
Starting applications specified in /home/roger/.vnc/xstartup
Log file is /home/roger/.vnc/svdapp95:1.log

2:root xauth:  creating new authority file /root/.Xauthority

New 'svdapp95:2 (root)' desktop is svdapp95:2

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/svdapp95:2.log

                                                           [  OK  ]
[root@svdapp95 .vnc]# /sbin/service vncserver stop
Shutting down VNC server: 1:roger 2:root                   [  OK  ]
[root@svdapp95 .vnc]#

5. Edit xstartup config file created in step 4 for each user added in vncservers in step 3:

[root@svdapp95 ~]# nano /root/.vnc/xstartup

Initial file for root:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

New file for root:

#!/bin/sh

# Add the following line to ensure you always have an xterm available.
( while true ; do xterm ; done ) &

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

… repeat for “roger” user too.

6. Start VNC server:

[root@svdapp95 ~]# /sbin/service vncserver start

7. Login to VNC server from web browser:

From another PC (you connect to VNC server with both users configured, for example:
- Open web browser
- Go to http://<ip-vncserver>:5801 for user “roger” and http://<ip-vncserver>:5802 for user “root”.
- In my case: http://172.23.3.197:5801

8. Login to VNC server from any vcn client, for example, vnc viewer:

- Open VNC Viewer
- Go to http://<ip-vncserver>:1 for user “roger” and http://<ip-vncserver>:2 for user “root”.

Open connection:

Remote access in CentOS:

References:
* VNC ( Virtual Network Computing )

http://wiki.centos.org/es/HowTos/VNC-Server

* Conexión a VNC a través de firewalls y proxys utilizando túneles SSH

http://www.eslomas.com/index.php/archives/2006/07/05/conexion-remota-vnc-proxy-firewall-tunel-ssh/

Share files between two SO is easy because there are different protocols for sharing resources (NFS, CIFS/SMB/Samba, FTP, …), but sharing files between two PCs with OS Linux based, and one of them as virtualmachine guest of another one is a bit more complicated. Here’s how to do it when we Mac OSX as HOST and CentOS as GUEST:

Mount DVD ISO image in CentOS VirtualBox guest

1. Previously, I have download DVD ISO image, then I have copied to my Mac OSX Host.

2. From Virtual Box menu, goes to Devices > CD/DVD Devices and mount selecting CentOS’s DVD ISO image (ISO previuosly added to VBox’s “Virtual Media Manager”).

3. In CentOS guest now you can see DVD iso mounted as /media/CentOS_5.5_Final

4. You can install packages directly off the mounted DVD ISO. Now, modify /etc/yum.repos.d/CentOS-Media.repo file, enter:

[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Media.repo

5. Make sure enabled is set to 1:

enabled=1

6. Save and close the file. To install packages from only DVD media repo, do this:

[root@localhost ~]# yum --disablerepo=\* --enablerepo=c5-media -y install <package-name>


Notes:
* –disablerepo=\*: disable all yum repo
* -y: assume yes to any question which would be asked
* –enablerepo=c5-media: enable c5-media repo

Install Virtual Box Additions in CentOS guest

Before anything, It is necessary install some packages as compiler gcc, kernel libs and sources.

1. Install the following packages with CentOS DVD ISO image mounted:

[root@localhost ~]# yum --disablerepo=\* --enablerepo=c5-media -y install gcc
[root@localhost ~]# yum --disablerepo=\* --enablerepo=c5-media -y install kernel sources
[root@localhost ~]# yum --disablerepo=\* --enablerepo=c5-media -y install kernel-devel

2. Unmount CentOS DVD ISO image and mount Virtual Box Guest Additions in your CentOS guest:

3. Restart CentOS guest

4. Now, install VBoxGuestAdditions in CentOS guest:

[root@localhost ~]# cd /media/VBOXADDITIONS_3.2.6_63112/
[root@localhost VBOXADDITIONS_3.2.6_63112]# sh VBoxLinuxAdditions.run

5. Restart CentOS guest again

6. Now you could use special functionalities as resize the guest windows, share files, etc…

Share files beetwen Mac OS X as Host and CentOS as Guest

1. In your Host Linux box:

$ mkdir /Users/chilcano/files2share

2. In main menu of your Linux Guest’s Virtual Box:

- Go to Devices > Shared Folders
- In popup, add shared folder and select Host’s folder (/Users/chilcano/files2share), set up a name as files2share and make permanent.

3. In your Guest Linux box opens a terminal window and create a new directory where you’ll mount shared folder

[root@localhost /]# mkdir /vbox_shared

4. In this terminal, enter the id command and look the output. We will use uid and gid:

[root@localhost /]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=root:system_r:unconfined_t:SystemLow-SystemHigh

5. Now, we will mount shared folder from Host to Guest. From terminal in Guest Linux:

[root@localhost /]# mount -t vboxsf -o uid=0,gid=0 files2share /vbox_shared

Make the Mounted Share permanent

You can make the shared folder mount automatically each time you start the CentOS guest by making an entry in /etc/fstab.

1. From the CentOS guest edit fstab:

[root@localhost ~]# sudo gedit /etc/fstab

2. Add a line at the bottom of file, and that looks like this:

files2share	/vbox_shared	vboxsf	rw,uid=0,gid=0	0	0

3. Verify mounted folder

In Mac OS X (host):

In CentOS (guest):

4. End.

References:

* CentOS: Install Packages Via yum Command Using DVD / CD as Repo

http://www.cyberciti.biz/faq/centos-linux-install-packages-from-dvd-using-yum/

* Implementing virtualbox shared folders between a Mac OS X host and Fedora guest

http://davidherron.com/content/implementing-virtualbox-shared-folders-between-mac-os-x-host-and-fedora-guest

http://forums.virtualbox.org/viewtopic.php?t=4960&highlight=install+guest+addition

* How to install Guest Additions in CentOS 5.1

* Share Folders Between a Linux Host and Linux Virtual Machine on VirtualBox

http://tuxtweaks.com/2009/06/share-folders-linux-host-linux-virtual-machine-virtualbox/

It is very difficult to install services on servers that are not connected to the Internet directly or through a proxy (critical servers), for example It happens in production environments, in this case we have to previously download the packages, transport them on USB flash drive and repeat this process as many times as packages and dependencies we have forgotten.
The situation is compounded when these critical servers are virtualized. If this is your case, I recommend you use the DVD / CD ISO images and mount them as your CentOS repositories.

If you are in doubt, follow this example for Tomcat:

1. Mount DVD Iso image as a media-repo in your CentOS Guest Virtual Box

2. Verify if you have Java installed in your Guest

[root@svdapp95 ~]# java -version
java version "1.6.0"
OpenJDK  Runtime Environment (build 1.6.0-b09)
OpenJDK Client VM (build 1.6.0-b09, mixed mode)

3. Install Tomcat5 from your media-repo already mounted

Note:
* It is not recommended to install Tomcat as ROOT, especially if It is for production environments.

[root@svdapp95 ~]# yum --disablerepo=\* --enablerepo=c5-media -y install tomcat5 tomcat5-webapps tomcat5-admin-webapps

4. Verify Tomcat5′s packages installed

[root@svdapp95 ~]# rpm -ql tomcat5
/etc/logrotate.d/tomcat5
/etc/rc.d/init.d/tomcat5
/etc/sysconfig/tomcat5
/etc/tomcat5
[...]
/var/log/tomcat5
/var/log/tomcat5/catalina.out

5. Start Tomcat5′s service

[root@svdapp95 ~]# service tomcat5 start
Starting tomcat5:                                          [  OK  ]

6. Put follow URL http://localhost:8080, now you can see Tomcat’s welcomepage.

7. You can see Tomcat’s log with:

[root@svdapp95 ~]# tail -f /var/log/tomcat5/catalina.out

8. End.

1. Download all RPM extra packages from: http://mirrors.nfsi.pt/CentOS/5.5/extras/i386

[root@svdapp95 ~]# wget -m http://mirrors.nfsi.pt/CentOS/5.5/extras/i386
or
[root@svdapp95 ~]# wget -m http://mirror.centos.org/centos/5.5/extras/i386

2. Upload RPMs packages to you Linux box, for example to /centos-ds_rpm_tmp

3. Verify that you have installed Java:

[root@svdapp95 ~]# rpm -qa | grep jdk
java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

4. Install required packages from mounted ISO images:

Note:
* Append ” –disablerepo=\* –enablerepo=c5-media install -y” to yum command if you want install from DVD Iso image, for example:

# yum --disablerepo=\* --enablerepo=c5-media -y install <package>
[root@svdapp95 ~]# yum install cyrus-sasl-gssapi db4-utils mozldap-tools perl-Mozilla-LDAP mozldap-devel

see installation output log 1

5. Install required supported packages from mounted ISO:

# yum install xorg-x11-xauth bitstream-vera-fonts dejavu-lgc-fonts urw-fonts

6. Install CentOS Directory Server

[root@svdapp95 ~]# cd /centos-ds_rpm_tmp
[root@svdapp95 ~]# yum --nogpgcheck localinstall centos-ds-8.1.0-1.el5.centos.2.i386.rpm \
    centos-ds-base-8.1.0-0.14.el5.centos.2.i386.rpm \
    centos-ds-base-devel-8.1.0-0.14.el5.centos.2.i386.rpm \
    centos-ds-console-8.1.0-5.el5.centos.2.noarch.rpm \
    centos-ds-admin-8.1.0-9.el5.centos.1.i386.rpm \
    adminutil-1.1.8-2.el5.centos.0.i386.rpm \
    centos-admin-console-8.1.0-2.el5.centos.2.noarch.rpm \
    centos-idm-console-1.0.1-1.el5.centos.2.i386.rpm \
    idm-console-framework-1.1.3-9.el5.centos.2.noarch.rpm \
    jss-4.2.5-1.el5.centos.1.i386.rpm

see installation output log 2

7. Verify FQDN (fully qualified domain name):

[root@svdapp95 ~]# hostname
svdapp95-ldap
[root@svdapp95 ~]# hostname -f
svdapp95-ldap.ohim-pre.eu

Note:
If you have some troubles, edit /etc/hosts and update it, and that looks like this:

127.0.0.1 svdapp95.ohim-pre.eulocalhost
::1 localhost6.localdomain6 localhost6

… and change your hostname to “svdapp95.ohim-pre.eu” with system-config-network command, go to DNS > Hostname and change it.

8. Create and configure Directory Server and Administration Server instances through of setup-ds-admin.pl:

[root@svdapp95 ~]# /usr/sbin/setup-ds-admin.pl

see installation output log 3

Verify installation

1. Verify if directory service is running:

[root@svdapp95 ~]# /etc/init.d/dirsrv status
dirsrv svdapp95-ldap (pid 4556) is running...

2. Verify if admin directory service is running:

[root@svdapp95 ~]# /etc/init.d/dirsrv-admin status
dirsrv-admin (pid 3308) is running...

3. Verify if 389 and 9830 ports are opened:

[root@svdapp95 ~]# netstat -tln | grep 389
tcp        0      0 :::389                      :::*                        LISTEN
[root@svdapp95 ~]# netstat -tln | grep 9830
tcp        0      0 0.0.0.0:9830                0.0.0.0:*                   LISTEN
[root@svdapp95 ~]# lsof -i:389,9830
COMMAND    PID   USER   FD   TYPE DEVICE SIZE NODE NAME
ns-slapd  3047 nobody    6u  IPv6  13523       TCP *:ldap (LISTEN)
httpd.wor 3133   root    3u  IPv4  13659       TCP *:9830 (LISTEN)
httpd.wor 3136 nobody    3u  IPv4  13659       TCP *:9830 (LISTEN)

4. Start directory instance if It is not running:

[root@svdapp95 ~]# /etc/init.d/dirsrv-admin start
Starting dirsrv-admin:
														  [  OK  ]
[root@svdapp95 ~]# /etc/init.d/dirsrv start svdapp95-ldap
Starting dirsrv:
	svdapp95-ldap...                                       [  OK  ]

Delete all files related to directory instance for installing a new instance

1. Start all services:

[root@svdapp95 ~]# /etc/init.d/dirsrv-admin start
[root@svdapp95 ~]# /etc/init.d/dirsrv start svdapp95-ldap

2. Delete all files or remove instance with ds_remove script:

[root@svdapp95 ~]# rm -rf /var/lib/dirsrv/slapd-<ldap-instance-id>
[root@svdapp95 ~]# /usr/sbin/ds_removal -s <ldap-instance-id> -w <admin-pwd> [-f]

* In my case <ldap-instance-id> = svdapp95-ldap
* -f: if ds_removal fails, use -f to force the removal process.
* Each Directory Server instance service must be running for the remove script to access it.

3. Re-run script setup-ds-admin.pl

Launch admin directory console

X Server and GDM runing in the linux box is required and X client in the client side. In Windows as client can you use Xming.

1. Open a xterm or console in your linux box.

2. Run centos-idm-console:

[root@svdapp95 ~]# centos-idm-console -a http://localhost:9830

User ID: admin
Password: <your-pwd>
Administration URL: http://localhost:9830

Add an object in Directory Server by centos-idm-console

1. Run Console

2. Open Directory Server console

3. Add an entry to Directory Server

Connection to CentOS Directory Server from Apache Directory Studio

1. Create a connection to CentOS Directory Server from Apache Directory Studio

2. Browse LDAP

Add an object in Directory Server by ldapmodify command

[root@svdapp95 ~]# /usr/lib/mozldap/ldapmodify -D "cn=Alba C.,ou=People,dc=ohim-pre,dc=eu" -w liferay -f addUsr-roger.ldif

Where addUsr-roger.ldif file contains:

dn: cn=roger,ou=People,dc=ohim-pre, dc=eu
changetype: add
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: top
cn: roger
sn: CARHUATOCTO
facsimileTelephoneNumber: 0034 123456678
givenName: ROGER
mail: roger@foo-bar.info
preferredLanguage: es
telephoneNumber: 0034 123456678
title: ICEfaces Programmer
uid: 333333
userPassword:: e1NTSEF9Q0N4SmxGRUpFZmxyVVYvbXk2cUJVV1N3QWdJbVcxbWtDbUkxdFE9P
Q==

Authenticate and Search an object in CentOS Directory Server

In this case, the ldap operations that can be used are “bind operation” and “search operation”.
CentOS Directory Server uses Mozilla LDAP tools — such as ldapsearch, ldapmodify, and ldapdelete — for command-line operations.
The MozLDAP tools are installed with Directory Server and are located in the /usr/lib/mozldap.
When running any LDAP command, make sure that you are using the MozLDAP utilities, otherwise the command will return errors.

[root@svdapp95 ~]# /usr/lib/mozldap/ldapsearch -x -D <binddn> -w <bindpwd> -b <basedn> <searchfilter>

* -x: performing sorting on server
* -D: bind dn (for authentication)
* -w: bind passwd (for authentication)
* -b: base dn
* <searchfilter>: RFC-2254 compliant LDAP search filter

[root@svdapp95 ~]# /usr/lib/mozldap/ldapsearch -x -D "cn=lluis,ou=People,dc=ohim-pre,dc=eu" -w liferay -b "dc=ohim-pre,dc=eu" "objectclass=inetOrgPerson"

Tuning CentOS Directory Server

1. Using dsktune:

[root@svdapp95 ~]# dsktune

References

* CentOS Directory Server, Basic Install

http://wiki.centos.org/HowTos/DirectoryServerSetup

* CentOS Directory Server On CentOS 5.2

http://www.howtoforge.com/centos-directory-server-on-centos5.2

* Index of /CentOS/5.5/extras/i386/RPMS

http://mirrors.nfsi.pt/CentOS/5.5/extras/i386/RPMS/

* Red Hat Directory Server – manual installation and configuration

http://www.redhat.com/docs/manuals/dir-server/8.1/install/index.html

Bye.