Search:  
Gentoo Wiki

HOWTO_Apache_with_Coldfusion_MX7


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Background

How to install Coldfusion MX7 with apache2

Assumptions

Installation

Downloads

I recommend you download the newest version of Coldfusion from the website, this howto has been tested with MX7.02. http://www.macromedia.com/cfusion/tdrc/index.cfm?product=coldfusion The file you will need is: coldfusion-702-lin.bin

Add user

While this is downloading, you will need to add a user that coldfusion will run as:

adduser cfusion

Make installer executable

Make the downloaded file executable:

chmod +x coldfusion-702-lin.bin

Modify installer

Since this file isn't really meant for gentoo, it tries to assume you have a really old kernel. This will need "fixing" by changing the export in the file, easily done with sed like so:

cp coldfusion-702-lin.bin coldfusion-702-lin.bak
cat coldfusion-702-lin.bak | sed "s/export LD_ASSUME_KERNEL/#export LD_ASSUME_KERNEL/" > coldfusion-702-lin.bin
Note: If this went well and you need diskspace, you can delete coldfusion-702-lin.bak

aaa

Run installer

Now you can run the installer: ./coldfusion-702-lin.bin

Walk through installer

Answer the questions in the installer:

=============================================================================== 
Choose Locale... 
---------------- 
 ->1- English 
CHOOSE LOCALE BY NUMBER: 1

Accept the agreement IF you agree.

Pre-Installation Check

A warning about C++ compatibily, you can probably ignore this on newer gentoo's.
PRESS <ENTER> TO CONTINUE WITH THE INSTALLER: <ENTER>.

Install Type

Install Type 
------------ 
If you do not have a serial number, select either 30-day trial or Developer 
Edition. 
 ->1- Install new version of ColdFusion MX with a serial number 
   2- 30-day trial 
   3- Developer Edition 
Installation Choice: <pick one>
Macromedia ColdFusion MX 7 (server configuration) Installed 
----------------------------------------------------------- 
You cannot install the server configuration of Macromedia ColdFusion MX 7 if it is already installed on this computer. 
Is there already a server configuration of Macromedia ColdFusion MX 7 installed on this computer? 
   1- Yes 
 ->2- No 
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 2

You can turn all three sub components off, but be sure to turn off option 3 !

Sub-component installation 
-------------------------- 
The following options are available for installation. 
An option with "[X]" in front will be installed and an option with "[ ]" will not. Choosing an option will toggle it on or off 
[X] 1) Getting Started Experience, Tutorials, & Documentation 
[X] 2) ColdFusion MX 7 Search Services 
[ ] 3) Start ColdFusion on system init 
4) Continue with installation

In case you change this, remember to change it everywhere.

Choose Install Folder 
--------------------- 
Select the directory in which to install Macromedia ColdFusion MX 7. 
Directory: 
 Default Install Folder: /opt/coldfusionmx7 
ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT 
     : /opt/coldfusionmx7 
INSTALL FOLDER IS: /opt/coldfusionmx7 
  IS THIS CORRECT? (Y/N): y
Existing ColdFusion Installation? 
--------------------------------- 
The installer could not determine if there was an earlier version of ColdFusion on this machine.  
If there is a  previous version of ColdFusion installed your settings can be migrated.  
Is there an earlier version of ColdFusion on this machine? 
   1- Yes 
 ->2- No 
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT: 2

This bit is important

Configure Web Servers 
--------------------- 
Please configure your web server(s).  If you do not configure a web server the 
built-in web server will be used on port 8500 or the next available port. 
   1- Add Web Server Configuration 
 ->2- Continue with installation 
Choice: 2
Runtime User 
------------ 
Enter the name of the runtime user.   This user must exist already on the system. 
User Name: (DEFAULT: nobody): cfusion
Administrator Password 
---------------------- 
Enter the password that you will use to control access to the ColdFusion MX 
Administrator. 
This field is required. 
Password:    
Confirm Password:   
RDS Password 
------------ 
The ColdFusion Remote Development Service (RDS) lets developers using 
Macromedia tools remotely connect to this server for development purposes. 
If this is a production server, Macromedia recommends that you disable RDS.  
Note, however, that disabling RDS also disables the directory browsing applets 
in the ColdFusion Administrator and some of the  functionality in the Report 
Designer. 
Enable RDS (required for Report Builder and DW Extensions) (Y/N) N
Installation Confirmation 
-------------------------
<installation overview>
PRESS <ENTER> TO CONTINUE:
Installation Complete 
--------------------- 
You have successfully completed the first step in installing Macromedia 
ColdFusion MX 7. 
To continue with your installation, go to /opt/coldfusionmx7/bin and type 
"./coldfusion start" to start your server. 
Once the server is started log in to the Configuration Wizard at 
http://[machinename]:8500/CFIDE/administrator/index.cfm 
PRESS <ENTER> TO EXIT THE INSTALLER:

Emerge requirements

You will need the following software for everything to work properly. The X libraries are needed for the coldfusion graphing service.

Note: I know X libraries shouldn't be on a webserver, but I haven't been able to disable the graphing service successfully; and the coldfusion administrator doesn't work without it.
emerge -av lib-compat x11-libs/libXp x11-libs/libXt x11-libs/libXtst

Replace the stock init script

The init script that comes with coldfusion doesn't work under Gentoo, so you will need to replace it with the one below.

mv /opt/coldfusionmx7/bin/coldfusion /opt/coldfusionmx7/bin/coldfusion.broken

Paste the file below with you favorite editor into a new /opt/coldfusionmx7/bin/coldfusion

File: /opt/coldfusionmx7/bin/coldfusion
#!/bin/sh
# chkconfig: 345 90 14
# description: starts the ColdFusion MX server

PATH=/usr/xpg4/bin:/bin:/sbin:/usr/bin:/usr/sbin:$PATH
CONNECTOR=""
RUNTIME_USER="cfusion"    # must be a real shell user
JAVA_HOME="/opt/coldfusionmx7/runtime/jre"
JAVA_EXECUTABLE="/opt/coldfusionmx7/runtime/jre/bin/java"
DOCROOT="/opt/coldfusionmx7/wwwroot"
CF_DIR="/opt/coldfusionmx7"

ID=`id -u`

if [ ! $ID -eq 0 ]; then
        echo "You must be root to start ColdFusion MX."
        exit 1
fi


cfstart() {

        [ -f $CF_DIR/bin/jvm.config ] || {

                ln -s $CF_DIR/runtime/bin/jvm.config $CF_DIR/bin/jvm.config

        }


        if [ "$OS" = "HPUX" ]; then
                ps -e | grep -e [c]fmx7 > /dev/null 2>&1 && {
                echo "ColdFusion MX 7 is already running"
                echo exiting
                exit 2
        }
                else
                ps -e | grep -w [c]fmx7 > /dev/null 2>&1 && {
                echo "ColdFusion MX 7 is already running"
                echo exiting
                exit 2
        }
        fi

        echo "Starting ColdFusion MX 7..."


        eval $CFSTART >> $CF_DIR/logs/cfserver.log 2>&1


        echo "The ColdFusion MX 7 server is starting up and will be available shortly."

        # Insert a sleep statement to give the server a few moments.

        sleep 12

        if [ "$OS" = "HPUX" ]; then
                ps -e | grep -e [c]fmx7 > /dev/null 2>&1 || {
                echo "There has been an error starting ColdFusion MX 7, please check the logs."
                exit 1
        }
            else
                ps -e | grep -w [c]fmx7 > /dev/null 2>&1 || {
                echo "There has been an error starting ColdFusion MX 7, please check the logs."
                exit 1
        }
           fi


        [ -f "$CF_DIR/bin/cfmx-connectors.sh" ] && {

                echo "======================================================================"
                echo "Running the ColdFusion MX 7 connector wizard"
                echo "======================================================================"

                sh $CF_DIR/bin/cfmx-connectors.sh && {
                        mv -f $CF_DIR/bin/cfmx-connectors.sh $CF_DIR/bin/cfmx-connectors-run.sh
                }
        }


        echo "======================================================================"
        echo "ColdFusion MX 7 has been started."
        echo "ColdFusion MX 7 will write logs to $CF_DIR/logs/cfserver.log"
        echo "It may take a while for the administrator to start, this is normal."
        echo "======================================================================"

}

cfstop() {

        if [ "$OS" = "HPUX" ]; then
        ps -e | grep -e [c]fmx7 > /dev/null 2>&1 || {
                echo "ColdFusion MX 7 does not seem to be currently running"
                return
        }
        else
        ps -e | grep -w [c]fmx7 > /dev/null 2>&1 || {
                echo "ColdFusion MX 7 does not seem to be currently running"
                return
        }
            fi

        echo "Stopping ColdFusion MX 7, please wait"

        eval $CFSTOP

        sleep 10


        if [ "$OS" = "HPUX" ]; then
        ps -e | grep -e [c]fmx7 > /dev/null 2>&1 && {
                echo "The ColdFusion MX 7 server seems to be hanging, will stop non-gracefully"
                ps -e | grep -e [c]fmx7 | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1
                sleep 2
        }
        else
        ps -e | grep -w [c]fmx7 > /dev/null 2>&1 && {
                echo "The ColdFusion MX 7 server seems to be hanging, will stop non-gracefully"
                ps -e | grep -w [c]fmx7 | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1
                sleep 2
        }
        fi

        if [ "$OS" = "HPUX" ]; then
        ps -e | grep -e [c]fmx7 > /dev/null 2>&1 && {
                echo "There are some very stubborn ColdFusion MX 7 processes that will not die, please kill the following PIDs by hand: "
                ps -e | grep -e [c]fmx7 | awk '{print $1}'
                echo exiting
                exit 1
        }
        else
        ps -e | grep -w [c]fmx7 > /dev/null 2>&1 && {
                echo "There are some very stubborn ColdFusion MX 7 processes that will not die, please kill the following PIDs by hand: "
                ps -e | grep -w [c]fmx7 | awk '{print $1}'
                echo exiting
                exit 1
        }
        fi

        echo "ColdFusion MX 7 has been stopped"
}


case `uname` in

        SunOS)
                OS=Solaris
                LD_LIBRARY_PATH="$CF_DIR/lib:$CF_DIR/lib/_solaris/bin"
                CFSTART='su $RUNTIME_USER -c "PATH=$PATH:$CF_DIR/runtime/bin; export PATH; LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd $CF_DIR/runtime/bin; nohup $CF_DIR/bin/cfmx7 -jar cfusion.j
ar -autorestart -start coldfusion &"'
                CFSTOP='su $RUNTIME_USER -c "PATH=$PATH:$CF_DIR/runtime/bin; export PATH; cd $CF_DIR/runtime/bin; $CF_DIR/bin/cfmx7 -jar cfusion.jar stop coldfusion"'
        ;;

        HP-UX)
                OS=HPUX
                CFSTART='su $RUNTIME_USER -c "PATH=$PATH:$CF_DIR/runtime/bin; export PATH; cd $CF_DIR/runtime/bin; nohup $CF_DIR/bin/cfmx7 -jar cfusion.jar -autorestart -start coldfusion &"'
                CFSTOP='su $RUNTIME_USER -c "PATH=$PATH:$CF_DIR/runtime/bin; export PATH; cd $CF_DIR/runtime/bin; $CF_DIR/bin/cfmx7 -jar cfusion.jar stop coldfusion"'
        ;;

        Linux)
                OS=Linux
                LD_LIBRARY_PATH="$CF_DIR/lib:$CF_DIR/lib/_ilnx21/bin"
                CFSTART='su $RUNTIME_USER -c "export PATH=$PATH:$CF_DIR/runtime/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; cd $CF_DIR/runtime/bin; nohup $CF_DIR/runtime/bin/cfmx7 -jar jrun.jar -autorestart -s
tart coldfusion &"'
                CFSTART='su $RUNTIME_USER -c "export PATH=$PATH:$CF_DIR/runtime/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; cd $CF_DIR/runtime/bin; nohup $CF_DIR/runtime/bin/cfmx7 -jar jrun.jar -autorestart -s
tart coldfusion &"'
                CFSTOP='su $RUNTIME_USER -c "env -i; cd $CF_DIR/runtime/bin; $CF_DIR/runtime/bin/cfmx7 -jar jrun.jar stop coldfusion"'

        # Some Java JVMs (both from Sun and IBM) don't work with the new floating stack
        # feature of the i686 version of glibc.  Force glibc to use the deprecated stack model.
        # Check if the OS is SuSE8.1 - if it is, do not use the deprecated stack model.
#       SUSEFLAG=`grep 'SuSE Linux 8.1\|UnitedLinux 1.0' /etc/SuSE-release /etc/UnitedLinux-release /etc/UnitedLinux-release 2> /dev/null`
#        if [ ! "$SUSEFLAG" ]; then
#                LD_ASSUME_KERNEL=2.2.5
#                export LD_ASSUME_KERNEL
#        fi
        ;;

        *)

        echo "Your OS: `uname` is unsupported"
        echo "exiting"
        exit 1
        ;;

esac

ARG=$1

[ -z "$ARG" ] && ARG=usage

case $ARG in

        start)
                cfstart
        ;;

        stop)
                cfstop
        ;;

        restart)
                echo "Restarting ColdFusion MX 7..."
                cfstop
                cfstart
        ;;

        status)
                if [ -x "$CF_DIR/bin/cfstat" ]; then
                        shift
                        $CF_DIR/bin/cfstat $@
                else
                        echo "$0: $CF_DIR/bin/cfstat no such file"
                fi
        ;;

    wsconfig)
        WSCONFIG_JAR=$CF_DIR/runtime/lib/wsconfig.jar

        if [ $# -eq 0 ]; then
            # no arguments so display built-in help from wsconfig.jar
            $JAVA_EXECUTABLE -jar $WSCONFIG_JAR -help
            break
        else
            # brief help
            if [ "$2" = "help" ]; then
                echo "To configure a webserver connector you must specify the -ws and -dir options."
                echo "If configuring Apache it is recomended that you also specify the -bin and "
                echo "-script options."
                echo ""
                echo "To list all configured webserver connectors use the -list option."
                echo "To remove a configured webserver connector use the -r option with the "
                echo "-ws and -dir options."
                echo "To remove all webserver connectors use the -uninstall option."
                echo "To upgrade all installed webserver connectors use the -upgrade option."
                echo ""
                echo "For more detailed help see $0 $1."
            fi
            break
        fi

        # pass on all args to wsconfig.jar
        shift
        $JAVA_EXECUTABLE -jar $WSCONFIG_JAR $@ -coldfusion
    ;;

        *)
                echo "Usage:$0 (start|stop|restart|status|wsconfig)"
        ;;

esac


exit 0

Link the init script

Now link the coldfusion startup script to your init directory

ln -s /opt/coldfusionmx7/bin/coldfusion /etc/init.d/coldfusion
Warning: if /opt/coldfusionmx7 and /etc are not on the same mountpoint, you'd better just copy it.

Configure apache

Create the file /etc/apache2/modules.d/40_mod_jrun.conf and paste from below.

Warning: Make sure you fill in your ip address in two places.
File: /etc/apache2/modules.d/40_mod_jrun.conf
LoadModule jrun_module /opt/coldfusionmx7/runtime/lib/wsconfig/1/mod_jrun20.so
 <IfModule mod_jrun20.c>
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ssl false
    JRunConfig Ignoresuffixmap false
    JRunConfig Serverstore /opt/coldfusionmx7/runtime/lib/wsconfig/1/jrunserver.store
    JRunConfig Bootstrap your.ip.add.ress:51011
    #JRunConfig Errorurl <optionally redirect to this URL on errors>
    #JRunConfig ProxyRetryInterval 600
    #JRunConfig ConnectTimeout 15
    #JRunConfig RecvTimeout 300
    #JRunConfig SendTimeout 15
    AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
 </IfModule>

 <IfModule mod_access.c>
  <IfModule mod_alias.c>
    Alias /CFIDE/ /opt/coldfusionmx7/wwwroot/CFIDE/
    Alias /cfide/ /opt/coldfusionmx7/wwwroot/CFIDE/
    <Directory /opt/coldfusionmx/wwwroot/CFIDE/>
      Options -All -Multiviews
      AllowOverride None
      Order Deny,Allow
      Deny from all
      Allow from your.ip.add.resses
    </Directory>
  </IfModule>
 </IfModule>

Finish installation

All that remains is to restart apache and coldfusion

/etc/init.d/apache2 restart && /etc/init.d/coldfusion restart

And possibly make sure that coldfusion starts up at system boot

rc-update add coldfusion default

Acknowledgements

Thanks to frameRATE & -Blade- from the Gentoo forums for the original post(s), and all the people that replied with additions. Original post: http://forums.gentoo.org/viewtopic-p-2530144.html

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Apache_with_Coldfusion_MX7"

Last modified: Sun, 18 May 2008 05:09:00 +0000 Hits: 4,701