Another Linux Railo MySQL install guide (no Apache)
This was meant to be a guide about setting up your server with Linux, Railo, Apache, and MySQL but I've dropped Apache. Why? Well its an overhead I don't need. Resin functions perfectly well as a HTTP server and it does all I need. Why add another bit of software to fail? .... simplify :) In the long run I might change but for now I'd rather save the resources.
So ... where did this guide come from considering there are quite a few guides for this setup? Well for one reason or another I just didn't get on with them and by the end something went wrong which was mainly because I am Mac boy more than a Linux guy and sometimes I just missed the points here and there. The aim of my guide is to be clear and simple. So with a fresh Ubuntu install i'm planning on gettingt Railo running via Resin so I can call http://www.mysite.com/index.cfm
I won't lie, to make this post I have "borrowed" from other sources out there which I will try and link to at the end.
Im running Ubuntu 8.10 (Intrepid) without a graphical interface.
Note: If you are doing this on a clean, new server then before you even read on check out Slicehost.com documentation about setting up a Ubuntu server. These guides are the best and clearest I've seen online to date and cover everything you need!!!!
- http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-1
- http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-2
On to Railo
- On your ubuntu server, open the Terminal and run:
$ sudo apt-get install build-essential apache2 sun-java6-jdk
This will install all the pieces you need for Java and compiling. If there are any problems installing Java then check out http://www.javadesign.info/SystemsHardware/OS/Ubuntu/install-java-on-ubuntu - We are going to install Railo into the /opt/ folder. So next we are going to move in to the /opt/ folder and download Railo;
$ cd /opt
- Go to Get Railo.org and the Download section. Find the links under Railo Server and copy the link for the ALL OS, tar.gz, and without JRE version. Currently this is http://www.getrailo.org/down.cfm?item=/railo/remote/download/3.1.0.012/server/all/railo-3.1.0.012-resin-3.1.2-without-jre.tar.gz
- With this link copied go back to the terminal and type $ wget {paste the URL link here with out the brackets}. So with the current URL your terminal syntax will be
$ wget http://www.getrailo.org/down.cfm?item=/railo/remote/download/3.1.0.012/server/all/railo-3.1.0.012-resin-3.1.2-without-jre.tar.gz
- We now have the downloaded Railo server in /opt/ and we're gonna unpack this with the following command
$ sudo tar -xf railo-3.1.0.012-resin-3.1.2-without-jre.tar.gz
This command will unpack the Railo file you downloaded in to a folder called "railo-3.1.0.012-resin-3.1.2-without-jre". - Don't worry about the long folder name for now as we will create a symbolic link in the next step to make referencing it easier.
$ sudo ln -s railo-3.1.0.012-resin-3.1.2-without-jre railo $ sudo chown -R {your username} railo
- A quick recap; at this point we have Java, Railo, and Resin installed and we are ready check we've done it right by firing up Railo
$ /opt/railo/bin/httpd.sh
now go to http://localhost:8600/ and Railo should be running and a link to the administrator. At the moment the only way to stop this service is with ctrl-c. Later on will start this in the background by adding an argument but before we continue ctrl-c in the terminal to stop Railo/Resin. - This is all well and good, but its not running off port 80 which is what most people, if like me, want. We're going to edit the Resin.conf file now and change the port from 8600 to port 80
- Open the Resin.conf file
$ sudo nano /opt/railo/conf/resin.conf
look for the line <http address="*" port="8600"/>, we're going to change the port to 80 - For each site you need edit the Resin configuration file again. Im going to add my sites to the directory /var/www/. So lets create our first site
$ mkdir /var/www/mysite
- Now edit our Resin.conf file at /opt/railo/conf/resin.conf
$ sudo nano /opt/railo/conf/resin.conf
Then around line 250, just before the following comment <!-- configures the default host, matching any host name --> add a host and host-alias's if you use them:
You can find out more about this here. Its even possible to use RegEx in there as well.www.mysite.com www.mysite.co.uk - Now restart the server
$ sudo /opt/railo/bin/httpd.sh start
This time we have passed "start" to the Resin command, this will load it as a service in the background. Then go to http://mysite.com and check it all work.
References:
- Ubuntu
- Get Railo
- Caucho Resin
- MySQL
- A BIG THANKS to Mark Mandel and his blog post which this is taken from and expanded.