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
them.
- 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. - Download Railo Server, the All OS version, without the JRE. (I tend to grab the .tar.gz version)
- 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-3.0.2.001-resin-3.1.2-without-jre.tar.gz - 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-3.0.2.001-resin-3.1.2-without-jre railo
sudo chown -R {your username} railo - Now we have actually got Resin and Railo installed, lets make sure they work, run:
/opt/railo/bin/httpd.sh
- Go to: http://{yourLinuxBox}:8600/, and you should see the Railo test page, with a link to the administrator.
- 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
make
#have to use sudo, as it installs the caucho apache module for us
sudo make install - Restart apache
sudo /etc/init.d/apache2 restart
- If you browse to http://{yourLinuxBox}/ you should see the railo test index.cfm
- If you browser to http://{yourLinuxBox}/caucho-status, you will see the status of the caucho module
- Browsing to http://railo/railo-context/admin/index.cfm will take you to the Railo admin.
- 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=""/>
</host> - 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.
- 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.
Comments
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’.
@Erik-Jan – thanks for that. Fixed.
Hi Mark,
Right off the bat I got "Can’t install Build-Essential" error and that was that 🙁
@mistypotato
What was the full error?
What disto are you on?
Every ubuntu distro I know has ‘build-essential’ as an APT package.
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>
when i try to run httpd.sh…..
the response is……..
httpd.sh: command not found
@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 http.sh to being executable, and other minor pieces that a usual ubuntu user would know.
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.
Kindly,
Misty
UPDATE….
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 🙂
@mistypotato:
Hi Misty,
Just a question about a mistake a used to make a lot:
are you trying run ‘httpd.sh’ OR ‘./httpd.sh’. 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/httpd.sh’ or change to the dir ‘CD /opt/railo/bin’ and the run ‘./httpd.sh’.
It worked for me, so it should be no different with you, as long as you followed Marks steps…
Hope this helps!
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.
Hi Erik-Jan,
I was double clicking directly on the file then choosing to "RUN" option.
(I have ubuntu-desktop) on my server
Hi guys,
A few questions….
Do I need resin if I have apache2 ?
also…
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.
thx
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…
sorry
Well,
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"
thx
also,
exactly where in the resin.conf did you place your "host" entries?
THANKS GUYS !!
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.
Misty
Anyone know if you can tell railo to ignore the CASE of data tables & sources
M
500 Servlet Exception
Got a license.
Cant find out how to apply / enter it
Searched and searched………..
why is everything so difficult ?
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.
Done.
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.
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?
@Ilya
Did you install apache2-threaded-dev?
Have a look to see if /usr/bin/apxs2 is there.
Which ubuntu are you on?
@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 .
@Ilya,
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.
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
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.
Regards
Devon
@Devon
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.
I feel like an idiot
When i run /opt/railo/bin/httpd.sh 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?
Thanks
@Nic – exit which screen, the putty screen? I’m not sure what you are asking?
I get the same behaviour as Nic – when I run railo/bin/httpd.sh 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).
The correct way of starting it (for me at least) was to type
sh httpd.sh start
in the correct directory
@Nic, @Fiddlesticks,
Oh! I see what you are saying now! Yes, when running httpd.sh, 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/httpd.sh &
The ‘&’ tells the Linux server to run the given process in the background.
Mark,
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 httpd.sh and hit it on port 8600 it works fine though. What could I have done wrong?
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.
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??
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.
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.
@Tim,
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.
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/httpd.sh start – all is fine, but shouldn’t this be automatic when the server restarts – Ubuntu 9.04
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
/opt/railo/bin/httpd.sh
Hey,
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 httpd.sh 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?
When I run /opt/railo/bin/httpd.sh, I get the error
exec: 40: -jar: not found
Any ideas?
-jar: not found for me as well
jar not found here too
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-3.1.2.001-resin-without-jre
Hope that helps …
@Doug Giles
Doug do you know how to make the JAVA_HOME setting permanent? I have to reset it each time I log in.
Thaks
Jeremy,
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
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.
I set my JAVA_HOME variable like this
export JAVA_HOME=/usr
You can also just edit the /opt/railo/bin/httpd.sh file like this
vim /opt/railo/bin/httpd.sh
Hope that helps
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.