Jan
24

As I was finishing this guide on installing ColdFusion 9 on Ubuntu Linux I tweeted how many words made up the text (over 6,000). Several people commented on Twitter and Facebook saying things like: "[the length] seems a bit excessive," and "is it that complicated?" The thing is, I'm covering much more than simply installing ColdFusion. Overall, just installing ColdFusion isn't that big of a deal. But I've yet to see a guide or blog post that outlines all the other topics related to getting a decent ColdFusion server on Ubuntu up and running. That's why I wrote this super guide, to outline what I believe is important to know about installing ColdFusion. Of course, I'm not covering every single possible detail, but I believe I've hit on all the major topics. Along the way I sprinkle in my own ideas, thoughts, and what I believe are best practices. After you read this post and walk through all the instructions you should have a very solid ColdFusion / Apache set up on Ubuntu Linux.

There are two important things to note, so please read on.

First, this post is all about Ubuntu. Everything you will read, all paths, and every setup aspect is written specifically for Ubuntu. I've tested these instructions on Ubuntu 10.04 (Lucid Lynx), but they should be accurate from 9.04 (Jaunty Jackalope) on. If you're disappointed this was written for Ubuntu, don't be. I have a CentOS post right here that covers all the same topics.

Secondly, and this is extremely important, all commands throughout this post are assumed to be run as root. Some of the commands can be run without root, but most of them cannot. So please, log into your Ubuntu server using the root account, put sudo in front of every command, or run the su - root command (under a non-root account) before walking through the instructions.

Before we get going, here's a list of what I'll be covering:

  1. Creating a Linux user for ColdFusion
  2. Disabling SSH and FTP login for the coldfusion user account
  3. Installing the required libstdc++.so.5 C++ Library
  4. Running the ColdFusion installer
  5. Starting ColdFusion for the first time
  6. Installing the ColdFusion 9.0.1 updater
  7. Verifying the installation of 9.0.1
  8. Creating a new ColdFusion instance for general use
  9. Tweaking the JVM memory settings
  10. Hooking Apache and ColdFusion together
  11. Locking down Apache
  12. Configuring ColdFusion to start on system boot

Continue Reading

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on January 24, 2011 at 8:50 AM. It was filed in the following categories: ColdFusion, Apache, Security, Linux. It has been viewed 146941 times and has 45 comments.

1 related blog entries

45 Responses to Super Guide: Installing ColdFusion 9 on Ubuntu Linux

  1. Nice post Aaron! I've got 3 points to add.

    1. RDS
    There is a bug in the installer which means RDS gets enabled during a Multiserver or EAR/WAR install even if you chose "no". So you need to go into your instances web.xml file after the installation has finished and comment out the RDS entries. Then you need to restart CF.

    There is a technote for this on Adobe.com

    2. JVM settings

    Unless I've missed it, you don't mention that you can start each CF instance using it's own JVM config file.

    Simply take a copy of the existing jvm.config file, change the necessary entries in the new file (server paths, server name) and then you can start you instance with it's own config file by typing:

    /opt/jrun4/bin/jrun -config "new_config_file" -start "instance"

    You'd obviously look to build this into your start up scripts

    3. Hook Apache with ColdFusion

    You missed one argument and this is -ws64

    You need to specify this if you're configuring 64 bit Apache and ColdFusion.

  2. @Andy - Thanks so much for taking the time to read the post and let me know about omissions and such.

    Re: RDS, yikes, I didn't know about that bug. Is it specific to CF 9.0 or 9.0.1? I'll make sure and double-check my own servers and then update the post accordingly.

    Re: JVM settings - starting an instance with it's own config file is definitely cool, but I'd consider that outside the scope of the guide. Maybe I should mention you can do what you describe, but that's it. As you probably realized reading the post it's written for folks who aren't very familiar with getting a ColdFusion server up and running on Linux. Linux experts and CF gurus probably won't learn much from the post.

    Re: the -ws64 argument. Thanks for bringing this to my attention. I have a 64-bit Ubuntu/CF install I need to check because I'm pretty sure I did not supply that argument when connecting Apache and ColdFusion. I'd expect the connector to fail, but since it didn't I'm wondering if I have everything in 64-bit mode /except/ the connector.

  3. The RDS bug affects 8 as well, according to the technote:
    http://kb2.adobe.com/cps/526/cpsid_52693.html

  4. @Andy, I checked on the RDS issue and it only affects installations where you are deploying an existing EAR or WAR file. My guide above discussions creating a brand new J2EE (JRun) install using the Multiserver option, not the EAR/WAR option. To be sure, I checked two CF instances that were installing using the Multiserver option (not EAR/WAR) and RDS is appropriately disabled on them.

    Nevertheless, you brought up a good point and folks who regularly use the EAR/WAR deploy option should take note.

  5. Aaron,

    This is fantastic. Thank you for taking the time. I am curious about one thing.

    NOTE: I have only skimmed this, but I also search for keywords (Sun, Oracle, OpenJDK) and did not see any references to changing the default OpenJDK that comes with Ubuntu over to Sun/Oracle. Do you recommend this?

    I had thought that it was recommended to use Sun Java with ColdFusion, and I thought that even I had had some problems with it once in the past, but I cannot specifically remember what they were.

    Thanks again, this is awesome.

  6. @Jason - Good question. When you install the Multiserver edition of ColdFusion 9 on Ubuntu and CentOS, the installer places version 1.6.0_17 of Sun Microsystems' JDK into the /opt/jrun4/jre folder. It sets the default JRE classpath of ColdFusion in jvm.config to this folder. If you don't change anything you will be running this JDK on Ubuntu and CentOS. I don't know if this is true or not for Windows.

    You can of course install a JDK from any vendor into any location on your server you want. Then, you update the path in the jvm.config file and restart ColdFusion. You can verify the change took affect by logging into one or more CF instances Administrator and click on the "i" icon in the upper right corner to view the System Information screen. The vendor and version number of the JDK CF is using will be listed here. I'm sure you already knew this, so I'm writing it in case someone else is reading and does not.

    Now, your question about which JDK vendor and/or version to use is a good one too. In ColdFusion 8 days there was a major issue in the 1.4.0_10 Sun JDK whereby invalid Object collection would cause out of memory issues in the JVM. Since this was the default vendor and version of JDK that shipped with CF 8, it was recommended on fresh installs of CF to immediately upgrade the JDK to 1.5.x.

    I only have experience with Sun's JDK but I've heard of others liking Oracle's JRockit.

  7. Jatin Nanda

    Aaron - thanks a lot for this guide. I've been trying to do this over the past few weeks with mixed results. Andy Allan pointed me to your post and subsequently saved me a lot of stress.

    All I would add (in my case) is make sure the appropriate ports are actually open on the server. This caught me out a couple of times.

    This article came to my rescue: http://www.cyberciti.biz/faq/howto-rhel-linux-open...

  8. Greg Wilson

    Hey Aaron - this is great! ChessJam, a multiplayer online game built in Flex, runs on Ubuntu with CF 9.01 and LCDS. After it ran for a few days with high activity, I started getting bizarre errors due to it being out of file handles and problems related to other limits. The following changes fixed all of the problems:

    In /etc/security/limits.conf -- add the following:
    root soft nofile 200000
    root hard nofile 200000

    * soft nofile 200000
    * hard nofile 200000

    In /etc/sysctl.conf -- add the following:

    fs.file-max = 200000

    I also found that I needed to tweak Apache.conf a bit:

    I changed keepalive from 15 seconds to 5 seconds

    I changed MaxRequestPreChild from 0 to 3000 -- if you leave it at zero, each child will run forever which eventually started causing issues for me. Setting it to 3000 forces the thread to stop and be replaced every 3000 requests.

    Once I made these changes, ChessJam runs smoothly for over 100 days with no hiccups.

    Greg Wilson
    Adobe
    http://gregsramblings.com

  9. @Greg - Good to know your ChessJam app is running well on CF + Ubuntu. Cheers.

  10. @Andy (and everyone else), I did some testing on Ubuntu 32-bit and 64-bit and learned the -ws64 switch to the connector tool wsconfig is never needed. It doesn't matter if you are on a 32-bit server or a 64-bit server, you never need to supply this switch. Whether you supply the argument or not, 32-bit servers will automatically get the 32-bit connector and 64-bit servers will automatically get the 64-bit connector.

    I spoke with the ColdFusion engineering team about this and was told the wsconfig tool uses the Java arch of your server to determine which Apache binary to use inside wsconfig.jar.

    Two things to note: The -ws64 switch is definitely required on Solaris 64-bit. And secondly, if you are running a 32-bit version of Apache on a 64-bit Ubuntu OS, you should use the -ws32 argument when manually configuring the connector. This will place a 32-bit version of the connector on the server that will properly work with 32-bit Apache.

  11. I got CF installed on Ubuntu and I am able to display a CF page in the /var/www/ directory. Great, thanks! However, I am having a lot of trouble figuring out how to get my files for my 8301 instance to show up. I get a permission denied on every page. The directory is /opt/jrun4/servers/prod-autofeed1/cfusion.ear/cfusion.war/. The only way the pages show up is if I include the port number in the url and apache doesn't seem to be serving the pages. I think it is jrun and it is so slow. Is there a step I missed? Any suggestions? Thank you.

  12. @James, it sounds like you need to hook your ColdFusion instance to Apache. Did you follow those steps from the post? The post talks about how accessing CF with URLs that have ports in them meaning you are using the internal Web server that's part of ColdFusion. If you want to have cleaner URLs without the port numbers you have to let Apache know ColdFusion is on the server. That's done by connecting CF and Apache with the Apache Connector, a utility that is included with the installation of ColdFusion.

  13. @Aaron, thank you for the response! I followed all of your steps above. There was a permission denied error when running the connector script. Now however, everytime I try to run the script again, it says, "This web server is already configured for JRun". This is the script I am using:


    /opt/jrun4/bin/wsconfig -ws Apache -dir /etc/apache2 -server prod-autofeed1 -bin /usr/sbin/apache2 -script /usr/sbin/apache2ctl -coldfusion -v

    Any suggestions? Thank you, James.

  14. I tried removing the Apache connector and then running the connector script again. It looked like the script worked, but I'm still getting the same result... CF pages are only being served with the port number in the URL. Any other suggestions?

    Here are the commands I ran:

    root@i-0xyt1j5t:~# /opt/jrun4/bin/wsconfig -ws Apache -dir /etc/apache2 -remove
    Using Apache control script /usr/sbin/apachectl
    Restarted Apache server
    The Apache connector was removed from /etc/apache2
    root@i-0xyt1j5t:~# /opt/jrun4/bin/wsconfig -ws Apache -dir /etc/apache2 -server prod-autofeed1 -bin /usr/sbin/apache2 -script /usr/sbin/apache2ctl -coldfusion -v
    Found JRun server prod-autofeed1 at 127.0.0.1:2908
    Using Apache binary /usr/lib/apache2/mpm-worker/apache2
    Server version: Apache/2.2.16 (Ubuntu)
    Using Apache control script /usr/sbin/apache2ctl
    Parsing Apache configuration file /etc/apache2/httpd.conf
    Exec'ing chmod 777 /opt/jrun4/lib/wsconfig/1
    Set permission to 777 on /opt/jrun4/lib/wsconfig/1
    Exec'ing chmod +x /opt/jrun4/lib/wsconfig/1/mod_jrun22.so
    Set permission to execute on /opt/jrun4/lib/wsconfig/1/mod_jrun22.so
    Created file /opt/jrun4/lib/wsconfig/1/mod_jrun22.so
    Wrote file /etc/apache2/httpd.conf
    Added JRun configuration to Apache configuration file /etc/apache2/httpd.conf
    Created file /opt/jrun4/lib/wsconfig/1/README.txt
    Wrote file /opt/jrun4/lib/wsconfig/wsconfig.properties
    Exec'ing /usr/sbin/apache2ctl restart
    Restarted Apache server
    The Apache connector was installed to /etc/apache2

  15. Figured out my problem with the help of a co-worker! The Apache connector was set correctly, but somehow permissions were messed up and Apache could not access my CF instance's directory. It works now! Thank you!

  16. @James, Awesome. Glad you got it figured out.

  17. Does anyone have experience using SOLR with ColdFusion 9 multiserver? Does SOLR get automatically setup with each new CF instance created? Or, do we have to ensure that the main CF instance (:8300) is running to use it? Any suggestions would be appreciated.

  18. @James - I haven't done anything with Solr since it took the place of Verity. But, Solr runs as a separate service from the JRun/CF service. You must install the Solr service, typically at the same time you are installing the CF9 server. You then manage the Solr service and the CF service independently. In other words you can start/stop Solr independently of starting and stopping CF.

  19. I ran into an interesting Ubuntu installation issue today with a Media Temple (ve) server. On (mt) the /tmp directory is mounted with noexec to avoid potential exploits. This interferes with the installers ability to use the bundled JRE to run itself.

    The easiest way around this problem is to temporarily bind the /tmp directory to a directory with exec permissions. Here's how I did this:

    mkdir ~/tmp
    mount --bind ~/tmp /tmp

    Then you can continue the installation as you normally would by running the installer. Once you're done, you simply unmount your temporary /tmp directory like this:

    umount /tmp

    This should eliminate the issue that keeps the installer from running properly on a Media Temple (ve) server.

  20. @Zach, thanks for the comment! I've never used MediaTemple but hopefully your comment will help folks out who run into trouble.

  21. Dommie

    Thanks for writing this up - I'm completely new to CF on Ubuntu. At my first attempt I hit the buffers when I get to accessing the CFAdmin for the first time after starting cfusion.

    In my case the url is

    http://192.168.0.8:8300/CFIDE/administrator/index....

    and I get

    Firefox can't establish a connection to the server at 192.168.0.8:8300.

    Have tried alternatives such as 127.0.0.1/localhost etc.

    Any advice is greatly appreciated

  22. @Dommie can you explain what you mean by "I hit the buffers?" I'm not sure what that means. Also, your connection error makes me wonder if you are using the right IP address for your machine. Check your IP address with the following command:

    ifconfig eth0 (replace eth0 with a different device if needed)

    You can run "ifconfig" without a device name to get a full report.

  23. Dommie

    Thanks Aaron for the quick reply

    Sorry, old school English slang for "I come up against an immovable object" :-)

    I got the "192.168.0.8" address from using the ifconfig command

    I can see other servers (e.g. 192.168.0.12) in my network without a problem from the same browser window

  24. @Dommie - do you have your Web server (I'm assuming it is Apache) configured to serve requests from the 192 IP address? What happens if you switch to one of the other machines on the same subnet and then ping 192.168.0.8? Do you get a response? Finally, forget ColdFusion for a second. Does the basic Apache home page come up if you try and browse to the IP address without the CF portions of the URL? These are all things to try to help you figure out what is wrong.

  25. Tim DeMoss

    No questions or problems. Just wanted to say thank you Aaron for such a thorough job on this. I was really nervous about uninstalling CF8 (which I installed without a helpful step-by-step like yours). This guide was simply excellent. Thank you!

  26. Max Hamby

    Aaron - Thanks for the write up but I'm having an issue with getting my hands on the libstdc++5 package (using 10.04). I've tried both methods but neither worked.

    Do you know if this is still a requirement?

  27. @Max - You may have already seen this, but I want to make sure first. I provided different instructions on getting libstdc++5 based on whether you are running 32-bit or 64-bit Linux. Did you see that and try the different approaches there? If yes, what happens when you run the apt-get install on the libstdc++5 library? Do you get an error? Package not found?

  28. Max Hamby

    @Aaron - Yeah, I've tried both sets of instructions. Both resulted in "package not found". It appears that I'm getting 404s on the jaunty source url when I run "apt-get update".

  29. @Max - You could edit your package sources to include universals and see if that helps.

  30. Brett

    Thanks for the tutorial

    I installed libstdc++5, looked OK but it still gives the warning can't determine if installed.

    Is this correct?

  31. Brett, I've not seen an instance where the warning message remains after installing libstdc++5. But, I've not tried every possible Linux OS out there. What OS + kernel are you trying to installing CF9 and libstdc++5?

  32. Brett

    Linux ubuntu 3.0.0-15-generic #26-Ubuntu SMP Fri Jan 20 17:23:00 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

    Ubuntu 11.10 \n \l

    Also get this error ..

    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...
    strings: '/lib/libc.so.6': No such file

  33. Hi,
    I'm making the switch from years of CF on Windows to CF on Linux (Ubuntu). Very glad I found your guide. Thanks!

    I had a problem installing the libstdc++ library. It doesn't look like it is still at the location you specified.
    After some googling I found it here.

    http://packages.ubuntu.com/lucid-backports/amd64/l...

  34. Thanks for the tip Matt. As newer versions of Ubuntu are released the package locations tend to shift. Welcome to the world of Linux, I hope you enjoy it.

  35. Aaron, thanks a lot for these instructions. Used them to build a development vm and have been loving it for a couple of months. However, when I first queried for a wsdl file after having built a webservice, i got this message:
    ----
    coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler: jikes: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory .
    ----
    I don't remember whether I had successfully installed it or not, so I went back to your directions and tried both 32-bit and 64-bit instructions. apt-get gave me this:
    ----
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Couldn't find package libstdc++5
    ----
    Any ideas? I'm running Ubuntu 10.04 LTS.

  36. I ended up getting the package from here:
    http://packages.debian.org/squeeze/i386/libstdc++5...
    ... and installing it by using the instructions here:
    http://knoppix.net/forum/threads/20775-apt-get-to-...

  37. @Colin - I'm glad you got it working. libstdc is an old bit of code that seems to make its way further into the ether with each new release of Ubuntu. Fortunately it can be picked up from some of the old packages. Thanks for posting your solution.

  38. Lisa Nagel

    This is the best tutorial I have ever seen for an installation! I am having issues, though...my pages in my CF Admin console are taking about 3 mins to load! It is driving me crazy...webpages work fine, etc...any ideas?

  39. Matthew

    Thanks for a very helpful tutorial. We used this to get CF9 up and running on Red Hat Linux. But I am confused by the permissions and wondered if you could clarify? CF is running as a user 'coldfusion', apache is running as a user 'apache' and serving files from '/var/www/html' as normal. But CF does not have permission to write files into any site directory (which prevents uploading images etc). All the directories are owned by 'root' or in the 'root' group. How do you configure the overall permissions so CF can write to your site folders but still run as the 'coldfusion' user? Many thanks.

  40. @Matthew - A typical solution would be to create a Linux group and then add your CF user and your Apache user to the new group. Then, tailor the group permissions based on the types of permissions you need ColdFusion to have from a disk perspective. I like to start at a "zero permissions" level and then add what is necessary as I run into issues. This ensures you don't have a Linux user/group and a software program like ColdFusion with more perms than are needed.

  41. Kevin Anderson

    Hi, Aaron:

    Great article... well written and concise. Really wish it would have worked for me! ;-)

    I'm running Mint 14 and ColdFusion 9.0.2 runs fine with its built in server on port 8500. Apache 2.2 runs fine on standard port. Connecting the two; however, doesn't work. It appears that Apache "changed" their configuration structure, etc., and CF wants and httpd[dot]conf, which doesn't exists anymore.

    I've tried a lot of different approaches, but nothing seems to work. Also, I'm a bit of a Linux newbie, so that is another challenge.

    Any ideas?

    Cheers!


    Kevin

  42. @Kevin, I don't have any experience with Mint but it sounds like the issue is with the connector. Are you getting any errors when you run the connector installer?

  43. Daniel @ Hosted Status Page

    Nice guide. Thanks for taking the time to write it and its helped me a lot.

  44. Thanks for the tutorial, it was really useful!

    I am having an issue with Apache 2.4 on Ubuntu 14.04 where by the test index.cfm is just outputting text not a date as expected.

    Can you tell me why this might be?

  45. @Justin - I'm glad you enjoyed the post! When you say "outputting text" do you mean your CFML source code is displayed in the browser? If yes, that generally means the webserver connector between ColdFusion and Apache isn't configured correctly. If this is indeed the problem you have to disconnect CF from Apache and rerun the connector piece.

    If you meant something else let me know and I'll see if I can provide greater detail.