Installing ColdFusion 7.0.2 with Apache 2.2 using CentOS 5Sunday October 24, 2021 19:34:53
This page is to help those who have laboured hard trying to get Coldfusion running under Linux and more recently with the new version of Apache 2.2.
CentOS 5 is a open source version of Redhat 5 enterprise which is relatively easy to get working and interacts fairly easily with Coldfusion although as you will read in what follows a few tweaks are necessary. Adobe claim that Redhat is officially supported but this might lead one to suspect that things will flow smoothly. They do not! I also found some of the support pages on Adobe to be difficult to deal with and some typographical errors seemed to make all the difference.
I have developed these notes from excellent help already available on the Internet which I will reference throughout and several installations later. Depending on the machine and the weather (it seems!) no installation is the same. While the material available on the Internet helped tremendously I found that in some cases it was (not to be unkind) not the most productive way to go and assumed away certain problems that have taken me some time to solve. So the sequence of events I outline here represents what I now think is the best way to go and which will work on (almost) any machine. It is more laborious but will get the job done.
Step 1: - Turn off SELinux
I consider it to give problems although if you read Steve Erat's excellent guide to installing Coldfusion on Fedora 6 (essentially CentOS 5) you will find he has some tweaks to overcome the problems. I prefer to deal with security at the firewall.
Step 2: - Check your version of Apache to make sure you have the issue
[root@machine]# httpd -v
So we know that a hotfix is currently available from Adobe to deal with the Apache 2.2. problem. The wsconfig.zip file provided should be downloaded.
After some experimentation I decided the best way was to make a directory for it on the Desktop which I called holder, unzip it and manually copy the JRun Apache 2.2 module mod_jrun22 to its final destination (more about which later). This was after I tried the instructions which accompanied the hotfix. On one machine they work while on another they do not. So
[root@machine holder]# unzip wsconfig.zip
To check the version of Linux to make sure any problems you encounter which my plan are not related to the distribution. Note I updated the Final release for some security fixes before I started - yum update.
Step 3: - Get the libXp runtime library
You will find that you need the X.Org X11 libXp runtime library which you can get from CentOS mirrors. Look for libXp-1.0.0-9.i386.rpm. Install it ahead of the Coldfusion installation to save yourself the problem that I describe below.
Step 3: - Pre-install the legacy C libraries
Make sure you install the Legacy C library when you setup linux. You should also check the presence of the shared libraries - libc.so.6. The installation requires them but the Coldfusion installation script seems to think it is missing.
[root@machine]# rpm -q --whatprovides libc.so.6
This establishes that I have the shared libaries installed. You will get an error during the Coldfusion installation anyway. I got the following solution from Steve Erat. I found this part of his resource very helpful and was very grateful.
Step 4: - add a runtime Coldfusion user
Tip: Make sure you have a run-time user installed on your system. For example, cfm. It should not be root.
Starting the Coldfusion installation:
This is the output from the installer after I launch the installation script as below. Also while Adobe says you can use the ./coldfusion-702-linux.bin -i gui switch it doesn't work on this distribution of Linux although I have used it on CentOS 4 Final.
[root@machine]# ./coldfusion-702-linux.bin Preparing to install... Extracting the JRE from the installer archive... Unpacking the JRE... Extracting the installation resources from the installer archive... Configuring the installer for this system's environment... awk: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory /bin/ls: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory Launching installer... grep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory /tmp/install.dir.3348/Linux/resource/jre/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
What is the solution to this?
Well until Adobe update their scripts the solution requires some editing of the installation scripts. Steve Erat documents this well and the steps require you to: (a) back up your coldfusion binary; (b) edit the installation script to weed out the offending lines. Note that he has compiled the shared wisdom from several sources including Dave Shuck. So the steps are:
1. Rename binary
[root@machine]# cp coldfusion-702-linux.bin coldfusion-702-linux.bin.backup
2. Use the following string replace command on the binary to comment out the line that is causing the problem
[root@machine]# cat coldfusion-702-linux.bin.backup | sed "s/export LD_ASSUME/#xport LD_ASSUME/" > coldfusion-702-linux.bin
3. Make the modified binary executable
[root@machine]# chmod 755 coldfusion-702-linux.bin
Step 2: - rerun the installation script
Now you have a choice. Once the installation script is running you will be asked whether to install with a WWW server (such as Apache) or finish the installation in Coldfusion's standalone server mode and then connect to Apache later. I guess it is here that I depart from Steve Erat and others who advocate installing the built-in webserver initially. I have done it both ways and I think additional problems (albeit trivial) emerge if you start with the built-in approach and then connect later. I think it is better to anticipate the now known problems and manually make the connection between Coldfusion and Apache so that it works from scratch.
Anyway, run the script and follow the screens making the relevant choices. The following output would have been generated if you installed the in-built server.
[root@machine]# ./coldfusion-702-linux.bin Preparing to install... Extracting the JRE from the installer archive... Unpacking the JRE... Extracting the installation resources from the installer archive... Configuring the installer for this system's environment... awk: cmd. line:6: warning: escape sequence `\.' treated as plain `.' Launching installer... Preparing CONSOLE Mode Installation... .... [HERE YOU MAKE YOUR SELECTIONS AND READ A LONG LICENCE AND THEN YOU GET] .... 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
Step 3: - Start the Coldfusion service
Now, if you had have installed the built-in server you would do the following:
1. Go to /opt/coldfusionmx7/bin and start the server [root@machine bin]# ./coldfusion start Starting ColdFusion MX 7... The ColdFusion MX 7 server is starting up and will be available shortly. ====================================================================== ColdFusion MX 7 has been started. ColdFusion MX 7 will write logs to /opt/coldfusionmx7/logs/cfserver.log ======================================================================
You can also start and stop the service using the Linux command service coldfusionmx7 start (stop). Now you are ready to login to the Coldfusion Administrator and finish the installation.
Step 4: - Graphing Service Not Available problem
Go to http://127.0.0.1:8500/CFIDE/administrator/index.cfm if you installed the built-in server and you will get an error if you didn't take the earlier tip to install the libXp runtime libary. You can go to the cfserver.log to find out that it is related to the Graphing Service. Here is the output to the log file.
05/22 21:33:25 Error [main] - Unable to initialize Graphing service: java.lang.UnsatisfiedLinkError: /opt/coldfusionmx7/runtime/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
So if you prepared well you will not have this problem - that is you will have already installed this runtime library. If you haven't go back to the preparation section and find the libXp rpm and install it with yum.
Step 5: - Restart the Coldfusion service
Restarting the service allows you to login to the Administrator and the first-time setup script executes. Your problems are however just beginning if you have Apache 2.2 running.
Connecting Coldfusion to the Apache WWW server
There are three clear options here. I will outline my preferred route as Option 3 and I recognise that approach is not part of the consensus out there in Coldfusion land that says that make the connection after you have Coldfusion up and running with its built-in server as described above. I have done it all three ways and conclude that Options 1 and 2 work sometimes but not always whereas Option 3 is failsafe.
Follow the built-in method above and then try to make the connection to Apache later. This will involve the following steps:
1. Download the wsconfig hotfix from Adobe
2. Configure the connector script. The following settings should be used in the apache_connector.sh found at /opt/coldfusionmx7/bin/connectors directory. You can find the relevant parameters as follows:
[root@machine bin]# rpm -q httpd httpd-2.2.3-6.el5.centos.1 [root@machine bin]# which httpd /usr/sbin/httpd [root@machine bin]# httpd -v Server version: Apache/2.2.3 Server built: Mar 21 2007 19:10:3 [root@machine bin]# which apachectl /usr/sbin/apachectl
3. Nano the apache_connector.sh as you will see:
#!/bin/sh # # Configure the Apache connector. # -dir should be the *directory* which contains httpd.conf # -bin should be the path to the apache *executable* # -script should be the path to the script which is used to # start/stop apache # ../../runtime/bin/wsconfig \ -server coldfusion \ -ws apache \ -dir /etc/httpd/conf \ -bin /usr/sbin/httpd \ -script /usr/sbin/apachectl \ -coldfusion exit $#
4. Then run the connector script:
[root@machine connectors]# ./apache_connector.sh Could not connect to any JRun/ColdFusion servers on host localhost. Possible causes: o Server not running -Start Macromedia JRun4 or ColdFusion MX server o Server running -JNDI listen port in jndi.properties blocked by TCP/IP filtering or firewall on server -host restriction in security.properties blocking communication with server
It was here that problems emerged. Steve Erat has some simple checks to follow which include
(a) Checking that the JNDI port was being listened to (2920 as defined in SERVER-INF/jndi.properties) [root@machine ~]# netstat -antp | grep "cfmx7" tcp 0 0 :::51011 :::* LISTEN 3971/cfmx7 tcp 0 0 :::2920 :::* LISTEN 3971/cfmx7 tcp 0 0 :::1099 :::* LISTEN 3971/cfmx7 tcp 0 0 :::45742 :::* LISTEN 3971/cfmx7 tcp 0 0 :::8500 :::* LISTEN 3971/cfmx7 (b) Checking /etc/hosts [root@machine ~]# more /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. [machine IP address] [machine_name.domain] [machine_alias] ::1 localhost6.localdomain6 localhost6 127.0.0.1 bilbo localhost
I generally failed to get past this point for reasons that are unknown and not covered by Steve's communication. Typically everything seemed to be okay but the connector wouldn't connect. So we turn to Option 2.
Option 2 - Adobe hotfix method
You can try the Adobe method which is well described here. It didn't work consistently for me however. Although you have to go there to get the new wsconfig.zip which has the updated jar file that you need to make the connection.
Option 3 - Manual installation
This is the preferred option in my view and should be done after you have installed Coldfusion but before you have tried to start it for the first time.
You can find a useful guide from Adobe and some of the steps below follow that guide closely.
Step 1: - Edit the jrun.xml file
Open the /opt/coldfusionmx7/runtime/servers/coldfusion/SERVER-INF/jrun.xml file and
If you had used the built-in option in the initial installation you would have to edit the JRun server entry (just above the Proxy Server xml) as:
So it should look like the following. Also see here which was helpful.
For one virtual server (Apache) only you can turn the multi-host cacheRealPath option to true.Step 2: - Create a directory for the virtual server
Create the following directory under under wsconfig:
Step 3: - Configuration file creation
(1) Create a file named wsconfig.properties in the /opt/coldfusionmx7/runtime/lib/wsconfig directory. This file has information necessary about the Apache web server configuration.
#JRun Web Server Configuration File # edited by bill 10.31 Thur May 24 1=Apache,/etc/httpd/conf,"","","" 1 .srv=localhost,"coldfusion"
(3) Save the file.
Step 4: - Configuring Apache
(1) Create a file jrunserver.store in the /opt/coldfusionmx7/runtime/lib/wsconfig/1 directory and edit it with
proxyservers=127.0.0.1:51011 The 51011 is for ColdFusion MX 7:
(2) After you had unzipped the wsconfig.jar from the Adobe hotfix download you can search within the huge number of files contained to find the mod_jrun22.so which is the fix for Apache 2.2 and above. You need to place this in the /opt/coldfusionmx7/runtime/lib/wsconfig/1 directory as well. Just copy it over. See also this which I found helpful.
(3) Nano /etc/httpd/conf/httpd.conf and at the end of the configuration file add the following lines of code. You can cut and paste from here if you like (making sure you keep everything on one line as below:
# JRun Settings LoadModule jrun_module /opt/coldfusionmx7/runtime/lib/wsconfig/1/mod_jrun22.so <IfModule mod_jrun22.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 127.0.0.1:51011 #JRunConfig Errorurl <optionally redirect to this URL on errors> AddHandler jrun-handler .cfm .cfml .cfc .jsp .jws .cfr .cfswf </IfModule>
Step 4: - Running the servers together
Now start Apache and Coldfusion:
[root@machine ~]# service httpd start
[root@machine ~]# service coldfusionmx7 start
Things should now nearly work.
That is it for now. Comments appreciated.
Next I will document hooking up MySQL 5 with Coldfusion MX7 which is very easy.
E-mail: bill.mitchell_@_newcastle.edu.au (delete underscores)