Installing Railo with Resin and Apache on Ubuntu Server

This took me the better part of a Saturday to get figured out, so I figured I would share it with you all.

There seem to be a few guides out there for installing Railo on RedHat based Linux distro's, but nothing for Debian based ones, so it was a bit of hunting around and trying things out to get this working.

I'm doing this all from my notes, which may not be perfect, so if I
miss anything out, or have a typo, please let me know, and I will amend

  1. On your ubuntu server, run:
    sudo apt-get install build-essential apache2 sun-java6-jdk apache2-threaded-dev
    This will install all the pieces you need for Apache, Java, and compiling.
  2. Download Railo Server, the All OS version, without the JRE. (I tend to grab the .tar.gz version)
  3. I like to untar the Railo archive in /opt, but it doesn't make a huge amount of difference, so
    cd /opt
    sudo tar -xf ~/railo-
  4. I also like to make a symbolic 'railo' link to the install, just for convenience, and make it so my user owns it.
    sudo ln -s railo- railo
    sudo chown -R {your username} railo
  5. Now we have actually got Resin and Railo installed, lets make sure they work, run:
  6. Go to: http://{yourLinuxBox}:8600/, and you should see the Railo test page, with a link to the administrator.
  7. Assuming the admin ran as expected, we get to compile the Apache
    connector, which is actually far simpler than you would think. Run:

    cd /opt/railo
    #we don't need to specify java-home, as apt takes care or it
    ./configure --with-apxs=/usr/bin/apxs2
    #have to use sudo, as it installs the caucho apache module for us
    sudo make install
  8. Restart apache
    sudo /etc/init.d/apache2 restart
  9. If you browse to http://{yourLinuxBox}/ you should see the railo test index.cfm
  10. If you browser to http://{yourLinuxBox}/caucho-status, you will see the status of the caucho module
  11. Browsing to http://railo/railo-context/admin/index.cfm will take you to the Railo admin.
  12. Now edit /opt/railo/conf/resin.conf, and set up <host> entries that match your Apache virtual hosts. This allows the Caucho module to know where to send the appropriate .cfm and .cfc requests.
    For example, I like to run each of my CF projects on a seperate port, so my resin.conf <host> entries look like:
    <host id="railo:71" root-directory="/mnt/hgfs/wwwroot/test">
        <web-app id="/" root-directory=""/>
  13. Resin will restart itself whenever it detects the resin.conf file has been changed, so if that hasn't happened, just hit a .cfm page again, it usually wakes it up.
  14. That's it… that should get you up and running with Resin and Railo on Ubuntu pretty quickly!

If you have any questions, please feel free to ask.  I'm not a Railo guru, but if I can help, I will.

Leave a Comment


  • Erik-Jan Jaquet | February 14, 2009

    Hi Mark, great tutorial. But I think you made a typo at the first step: ‘build-essentials’ should be without the s at the end: ‘build-essential’.

  • Mark | February 15, 2009

    @Erik-Jan – thanks for that. Fixed.

  • mistypotato | February 15, 2009

    Hi Mark,
    Right off the bat I got "Can’t install Build-Essential" error and that was that 🙁

  • Mark | February 15, 2009

    What was the full error?
    What disto are you on?
    Every ubuntu distro I know has ‘build-essential’ as an APT package.

  • mistypotato | February 15, 2009

    Gosh I hate to think Im this incapable….
    Never stopped working on this since 7:00am this morning and I STILL can’t get railo to work….getting tire..maybe try again tomorrow <sigh>

  • mistypotato | February 15, 2009

    when i try to run…..

    the response is…….. command not found

  • Mark | February 15, 2009

    @mistypotato – I have to ask, have you used ubuntu server before?

    I have assumed a certain level of understanding with Ubuntu server here, i.e. you may have to chmod to being executable, and other minor pieces that a usual ubuntu user would know.

  • mistypotato | February 16, 2009

    Hi Mark,
    I would appreciate your help greatly.
    I am indeed very new to Linux (obvious , right?) 😉
    my apologies for the lack of basic knowledge.
    I would imagine that given the current OS environment (ie Microsoft), there will be an increase in the number of "newbies" discovering ubuntu now more than ever.
    It seems that much documentation is often written with a certain level of assumed knowledge of ubuntu and that’s understandable. I lost my WinXP server suddenly and unexpectedly to the recent wave of virus activity on the net and so was thrust involuntarily into this arena just one week ago. (I have absorbed so much in that time, and yet so far to go 😉

    Anyway, you help would be wonderful if you can give it.

    The permissions to this file are rwx (for all at the moment).
    I’m thinking my Java install may not be working properly so I’m trying to figure out how to test the Java install.

  • mistypotato | February 16, 2009


    I was tying to access railo through another computer in the office on a different Broadband connection and network.

    I just tried it Locally (on the server and voila! It opened 🙂

  • Erik-Jan Jaquet | February 16, 2009

    Hi Misty,

    Just a question about a mistake a used to make a lot:

    are you trying run ‘’ OR ‘./’. Ubuntu needs the ./ in front of the command, if you are in the same directory.

    So either run the command with the full path, ‘/opt/railo/bin/’ or change to the dir ‘CD /opt/railo/bin’ and the run ‘./’.

    It worked for me, so it should be no different with you, as long as you followed Marks steps…

    Hope this helps!

  • mistypotato | February 16, 2009

    I think after I get everything working, I may create a "Railo, total absolute ubuntu/Linux newbies How-To" for this to help others in my situation.

  • mistypotato | February 16, 2009

    Hi Erik-Jan,
    I was double clicking directly on the file then choosing to "RUN" option.

    (I have ubuntu-desktop) on my server

  • mistypotato | February 16, 2009

    Hi guys,
    A few questions….
    Do I need resin if I have apache2 ?
    When I try to open a CFM page, I get the actual source for the page. So, it isn’t going through railo. Is thee "newbie" documentation for this as I can’t seem to find info specific to this.

  • mistypotato | February 16, 2009

    wait a minute…in my nubiness…I didnt even realize Mark had covered this as it was all Greek to me. I’m trying his compile steps above now…

  • mistypotato | February 16, 2009

    The compile, make and make install seemed to go ok..

    Just tried the resin.conf changes but I’m still getting the actual source code for cfm pages instead of the processed cfml output.

    Mark, can you explain this line….
    <host id="railo:71" root-directory="/mnt/hgfs/wwwroot/test">

    and specifically how you came up with your host id of "railo:71"


  • mistypotato | February 16, 2009

    exactly where in the resin.conf did you place your "host" entries?

  • mistypotato | February 16, 2009

    It’s working 🙂
    I’m able to open cfm pages now. (sigh of relief).
    Thanks for this tutorial Mark and your patience with this ubuntu noob.
    Now I just need to do some fine tuning.

  • mistypotato | February 16, 2009

    Anyone know if you can tell railo to ignore the CASE of data tables & sources


  • mistypotato | February 16, 2009

    500 Servlet Exception

    Got a license.

    Cant find out how to apply / enter it

    Searched and searched………..

    why is everything so difficult ?

  • mistypotato | February 16, 2009

    For the benefit of others.

    You may reach a point in railo whee it stops serving pages and simply returns a 500 error and some gibberish

    You will need to shut down your server and restart it to clear this.

    Once you shut down and restart your server ( I had to turn my computer completely off), you can then get back into the railo adminstration panel.

    From there go to server administration and look near the bottom for Serial number, click on that.

    Enter the serial number you got from your railo registration and click change.


    Simple once you know, a nightmare if youre a noob fighting 1000 other sever issues and frantically trying to get your server back up…
    and waiting is NOT an option

    Hope that helps someone save some time….took me 1.5 hours of tedious online research to get it. even the yahoo mail list for railo turned up 0 (zero) results for the word license. Go figure.

  • Ilya Fedotov | February 17, 2009

    when I run ./configure –with-apxs=/usr/bin/apxs2
    It runs ok for a while but at the end gives me following error
    creating libtool
    configure: error: bad apxs /usr/bin/apxs2

    I already had apache installed so I am thinking it has something to do with where apache is or something like that.
    any ideas?

  • Mark | February 17, 2009

    Did you install apache2-threaded-dev?
    Have a look to see if /usr/bin/apxs2 is there.
    Which ubuntu are you on?

  • Ilya Fedotov | February 17, 2009

    @Mark, no I didn’t install apache2-threaded-dev
    I this another part of apache or a different distro altogether?
    I do not have /usr/bin/apxs2, I am on ubuntu 8.10 and I don’t have anything that’s apxs
    I can’t remember now if I had installed apache2 or it was installed when ubuntu was installed. I just now unnstalled apache and was going to reinstall it with command in your blog post here.

    By the way I am trying to have Railo run along side Adobie engine, and this on my dev laptop. I already have (well had untill I blew off apache) CF8 running fine and wanted to see if I can get same site running under Railo by creating different virtual host .

  • Mark | February 17, 2009

    Please follow the instructions outlined above.

    Step 1 installs several packages, one of which is apache-threaded-dev. Without all of these packages, this installation of Railo will not work.

  • Ilya Fedotov | February 17, 2009

    Thanks Mark it worked now, by the way do you have any tips on mail server settings in dev environment? I am getting an error that mail server is not setup. I used to just put localhost on CF8 but it doesn’t seem to work in Railo
    thanks again for your help

  • Devon | March 7, 2009

    Hi Mark
    Thanks for the great guide (and Transfer).
    I was hoping to get apache/resin setup so I could view cfm pages just as I view php pages, without the 8600 port number appended to the host. Is this possible? If so, any directions on that?
    Thanks in advance for any help.

  • Mark Mandel | March 8, 2009

    You can use this guide to set up Apache/Resin on whatever port you like, so just configure it for port 80, and away you go.

  • Nic | April 9, 2009

    I feel like an idiot
    When i run /opt/railo/bin/ from my remote console with putty, then I don’t know how to get out of that screen

    I tried quit exit :q but nothing works and i have to stop my ssh session and it stops the server.

    How do i get out of this screen without stopping railo?

  • Mark | April 10, 2009

    @Nic – exit which screen, the putty screen? I’m not sure what you are asking?

  • Fiddlesticks | April 18, 2009

    I get the same behaviour as Nic – when I run railo/bin/ through putty the program starts but it does not return me to the command prompt (as it does when you start apache).
    The demo page and caucho-status page work ok in the browser until I hit CTRL+c in putty to exit, at which point the admin page is no longer served and caucho-servlet engine shows 1. localhost:6800 (down) (it goes red, rather than green).

  • Fiddlesticks | April 18, 2009

    The correct way of starting it (for me at least) was to type

    sh start

    in the correct directory

  • Mark | April 20, 2009

    @Nic, @Fiddlesticks,
    Oh! I see what you are saying now! Yes, when running, you don’t get returned to the command prompt while Railo is running.

    I usually run it that way, as it’s easier to restart, simply by pressing ctrl+c, rather than doing a kill/killall.

    If you want to run it in the background, run it as
    /railo/bin/ &

    The ‘&’ tells the Linux server to run the given process in the background.

  • Dave | April 28, 2009

    Firstly, thanks for the tutorial! I’m having a small problem though. I created the symlink and then chowned it to my user but when I run ./configure I have to use sudo or it won’t work and the same with make. I didn’t see why this would be a problem so I just went ahead and did it that way but apache is 503ing on me. When I run and hit it on port 8600 it works fine though. What could I have done wrong?

  • Daniel | May 4, 2009

    Thanks for the great post. I got it working. I had trouble with Sun’s JDK, I went with OpenJDK. Also, I had to make my user account an owner of not only the Railo alias but of the entire directory name. But thanks a lot.. it works great.

  • Erci | May 20, 2009

    Hi. I am trying to perform this install on 8.04 LTS (hardy) and am also getting the following error:

    configure: error: bad apxs /usr/bin/apxs2

    When I try to install to install apache2-threaded-dev I get this error:

    apache2-threaded-dev: Depends: libaprutil1-dev but it is not going to be installed

    I’m a bit of a linux newbie so I tried installing "libaprutil1-dev" but that didn’t work. I’m not coming up with much googling for answers. Can anybody offer some pointers as to why I am getting these errors??

  • Erci | June 2, 2009

    Hm.. I’m still encountering the issue stated above.. Does anybody know why apache2-threaded-dev will not install on my server? Could it be a problem that is it 64 bit? Any suggestions as to how I might get around this would be *greatly* appreciated.

  • Tim | June 17, 2009

    Thanks for this howto. Everything is working for me except that anthing NOY .cfm isn’t loaded from the ROOT directory. I have my application installed in/opt/railo/webapps/ROOT/XQDCS and can ad everything as http://myhost/XQDCS/something.cfm and it works, I can call other cfm scripts from inside the script with just it’s name, as it should. But any other file type and I get a 404 error. I found that if I put the file I’m trying to load in /var/www/XQDCS it loads fine. This tell me I’ve missed something in setup, but I have no idea what it is. I’m running on 8.04.

  • Mark | June 17, 2009

    Sounds like you’ve not configured apache properly. I didn’t cover that in this article, because I assumed people would know how to do that already / work it out.

    Check the Apache documentation for how to configure a Virtual Host.

  • Rich | August 28, 2009

    Got it all running fine until I try and restart. After a reboot I can’t get resin to load without running it from the shell again.

    As soon as I run sudo /opt/railo/bin/ start – all is fine, but shouldn’t this be automatic when the server restarts – Ubuntu 9.04

  • Aaron Greenlee | August 31, 2009

    Rich, I think you need to make a script in the /etc/init.d/ directory. Try

    sudo vim /etc/init.d/railo

    And then add the following

    #!/bin/sh -e

  • Richard | November 8, 2009

    i tried your method on ubuntu and it worked flawlessly. now im trying on my debian server and im having problems. i got up to point 5 where the script just hangs. i have all the permissions correctly set – but the script doesn’t seem to want to run. everything seems to be installed correctly. any ideas?

  • Jon | December 7, 2009

    When I run /opt/railo/bin/, I get the error
    exec: 40: -jar: not found
    Any ideas?

  • Jonathan | December 7, 2009

    -jar: not found for me as well

  • 5h4rk | December 10, 2009

    jar not found here too

  • Doug Giles | December 18, 2009

    I was getting the "jar not found" error also, and resolved that by setting the JAVA_HOME environment variable. I set my JAVA_HOME to /usr/lib/jvm/java-6-sun. (Your path may be different.)

    It looked like I needed to change the ownership of the Railo files in step 4 using the physical directory, not the symlink:

    sudo chown -R {my username} railo-

    Hope that helps …

  • Jeremy P | December 24, 2009

    @Doug Giles

    Doug do you know how to make the JAVA_HOME setting permanent? I have to reset it each time I log in.


  • Doug Giles | December 24, 2009


    There are probably a few ways to make JAVA_HOME permanent. I set mine in my .bashrc file (which is in my home directory).

    I added this line:

    export JAVA_HOME=/usr/lib/jvm/java-6-sun

  • Chris | March 3, 2010

    Still getting "exec: 40: -jar: not found" error. I’ve changed owner to phys directory and sym link. Also I’ve set the JAVA_HOME variable in .bashrc. Any Ideas? I’m trying to run on Ubuntu 9.10 64bit (could be the problem?) using latest Railo download.

  • John Gag | August 13, 2010

    I set my JAVA_HOME variable like this

    export JAVA_HOME=/usr

    You can also just edit the /opt/railo/bin/ file like this

    vim /opt/railo/bin/

    Hope that helps

  • Adam | October 6, 2010

    Thank you for your post. Unfortunately Railo itself is not well documented, lot of frustration in configuring and getting it working. Its not going to hit the big time until there’s decent documentation.