Wednesday, December 30, 2015

Liferay bundle with jboss + RHEL 7

This is the instruction on how to install jboss on Redhat Enterprise Linux 7 (RHEL 7)

you can signup and download Liferay from

for my case, i created /opt
and unzip the zip file into it
# unzip

before we start anything, i had manual downloaded Java JDK 7 release 79 and install it

once you extract out liferay, please try to run it to confirm the file you download is working
# cd /opt/<Liferay>/<jboss-version>/bin
# ./

you can test it by access with browser
by default, standalone is listen to only and if your Linux didnt install with gui, you need to mortify it.
CTRL + C to stop the jboss

# cd ..
# cd standalone/configuration/
# vim standalone.xml

----------------  Default  -------------------
        <interface name="management">
            <inet-address value="${}"/>
        <interface name="public">
            <inet-address value="${jboss.bind.address:}"/>
        <interface name="unsecure">
            <inet-address value="${jboss.bind.address.unsecure:}"/>

-------------- Change to -----------------
        <interface name="management">
            <inet-address value="${<your server ip>}"/>
        <interface name="public">
            <inet-address value="${jboss.bind.address:<your server ip>}"/>
        <interface name="unsecure">
            <inet-address value="${jboss.bind.address.unsecure:<your server ip>}"/>


restart the jboss liferay and test again using your <server-IP>:8080
# cd ../../bin/
# ./

----------------  Connecting to MySQL Database  ---------------------
you need to download the mysql connector from
choose JDBC Driver for MySQL (Connector/J)
extract the file and copy the mysql-connector-java-5.1.38-bin.jar
to this location
edit the module.xml
add this under <resource>
<resource-root path="mysql-connector-java-5.1.38-bin.jar" />


                <resource-root path="hsql.jar" />
                <resource-root path="jtds.jar" />
                <resource-root path="mysql-connector-java-5.1.38-bin.jar" />
                <resource-root path="portal-service.jar" />
                <resource-root path="portlet.jar" />
                <resource-root path="postgresql.jar" />

------------------  Configure httpd to divert traffic to Liferay jboss ------------------
Download and install httpd-devel
# yum install httpd-devel

download mod_jk from
extract it the file, configure, make and make install
it will automatic deploy the mod_jk into your apache

If you encounter error saying
no apache given
no netscape given
configure: error: Cannot find the WebServer

then you need to configure --with-apxs
but before that, find out your apxs location
# find / -iname apxs
# ./configure --with-apxs=/usr/bin/apxs

now go to /etc/httpd/conf.d/
create file and put this into it
# vim



# Load-balancing behaviour

then create mod_jk.conf file and put this into it
# vim mod_jk.conf

LoadModule jk_module modules/

<IfModule mod_jk.c>
JkWorkersFile /etc/httpd/conf.d/
JkShmFile     /var/log/httpd/mod_jk.shm
JkLogFile     /var/log/httpd/mod_jk.log
JkLogLevel    info,debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkMount /* worker1

Before we start apache, we need to configure the jboss to listen to port 8009 AJP1.3
by default it was disable at standalone.xml

# cd /opt/liferay-portal-6.2-ee-sp14/jboss-7.1.1/standalone/configuration/
# vim standalone.xml

----- default ------
        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
                <jsp-configuration development="true"/>
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
                <alias name=""/>

------- change to  --------
        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
                <jsp-configuration development="true"/>
            <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
                <alias name=""/>

Start jboss and httpd service and test it by accessing your server ip without port 8080
once success to see the pages, now we need to create a startup script

---------- startup --------------

by default, in jboss/bin/init.d directory, it already have the startup script name
If you are using RHEL 6 or before, you can just make a symlink from /etc/init.d/jboss and point to this file
for RHEL7, it a bit tricky since it use systemd

but before that, edit the and define the 

then go to /usr/lib/systemd/system
create jboss.service file and put this

Description=Jboss Application Server

ExecStart=/opt/<liferay-location>/<jboss-ver>/bin/init.d/ start
ExecStop=/opt/<liferay-location>/<jboss-ver>/bin/init.d/ stop


then go to /etc/systemd/system/ and create symlink point to the file just now
then enable this for startup list
# systemctl enable jboss.service

No comments:

Post a Comment