Friday, May 20, 2011

Setting Up a Mutli-CFML Engine Development Server

Summary

After attending the cf.Objective() 2011 conference last week, and attending Matt Woodward’s “Running Mulitple CFML Engines on Apache Tomcat” session, I wanted to setup a development server running multiple versions of the CFML language.  I decided to setup this server with the following technologies:

I’m sure I’ll repeat this process at some point in the future so I wanted to record these steps to simply the process in the future, and perhaps someone else might find them helpful.  Note that I’m installing all of this in a virtual machine on my Mac using VMware Fusion, however you should be able to do the exact same thing using VirtualBox.

Install Ubuntu Server

  1. Download the server ISO and install this in your virtual machine
  2. Accept all of the default options and make sure you select the “OpenSSH” option when prompted near the end.
  3. We need to modify the packages source for one of the components required for ColdFusion, so open the sources list by typing
    nano /etc/apt/sources.list
  4. Add the following line as the first line under “universe” packages
    "deb http://us.archive.ubuntu.com/ubuntu jaunty main universe"
  5. Now we’ll install some additional packages that are needed for the guest tools by your virtualization software and ColdFusion, as well as upgrade the server software to the latest versions by typing
    sudo apt-get update
    sudo apt-get install build-essential gcc linux-headers-$(uname -r) libstdc++5 
    sudo apt-get upgrade 
    sudo apt-get dist-upgrade"
  6. Determine your virtual machines IP address by typing “sudo ifconfig” and recording the 192.x.x.x address as you’ll need later.
  7. Install the VMware Tools or VirtualBox Guest Additions for best performance.  If you’re on VMware Fusion you’d type the following:

    sudo mkdir /mnt/cdrom
    sudo mount /dev/cdrom /mnt/cdrom
    ls /mnt/cdrom
    tar xzvf /mnt/cdrom/VMwareTools-<x.x.x-xxxx>.tar.gz -C /tmp/
    cd /tmp/vmware-tools-distrib/
    sudo ./vmware-install.pl -d
    sudo reboot
    

    Install Apache HTTP Server

    • Install the Apache web server by typing “sudo apt-get apache2”
    • Browse to http://<server_ip_address_here> to verify the installation is successful and running

    Install MySQL Client & Server

    • Install the MySQL client and server by typing “sudo apt-get mysql-client mysql-server”
    • Set the root password when prompted

    Install Oracle Java

    • Download the latest Java JDK, make sure to NOT select the one with the “RPM” in the file name, you do NOT want that file.
    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp jdk<full file name here> <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Login to the Ubuntu server
    • Make the Java package executable by typing
      sudo chmod +x jdk<full_file_name_here>
    • Execute the Java package by typing
      sudo ./jdk<full_file_name_here>
    • Make a general java directory for holding the Java VM for the system by typing
      sudo mkdir -p /opt/java
    • Copy the Java installation to the /opt/java directory by typing
      sudo cp jdk<full_file_name_here>/ /opt/java/
    • Now we need to add the Java path to the environment variable for easy access.  It’s important to note the actual directory name created for your version of Java as it maybe different then mine.  My entire path is /opt/java/jdk1.6.0_25/
    • Modify your environment variables by typing
      sudo nano ~/.bash_rc
    • Add the following lines:
      PATH=${PATH}:/opt/java/jdk1.6.0_25/bin  #you'll need to change if your directory name is different
      export PATH
      JAVA_HOME=/opt/java/jdk1.6.0_25  #you'll need to change if your directory name is different
      export JAVA_HOME
      
    • Now exit the editor by holding down the Control key and pressing the “X” key, type “Y” to save and then the Enter key to retain the same file name.
    • Restart your server

    Install Apache Tomcat 7

    • Download the latest .tar.gz file
    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp apache-tomcat<full_file_name_here>  <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Extract the Tomcat archive by typing
      tar -xf apache-tomcat<full_file_name_here>
    • Delete the archive by typing
      sudo rm -rf apache-tomcat<full_file_name_here>
    • Now we’ll rename the directory to make it easier to reference by typing
      sudo mv apache-tomcat tomcat
    • Move the Tomcat program to the /opt directory by typing
      "sudo mv tomcat /opt
    • Now we need to modify the environment for Tomcat, to do this type “sudo nano /opt/tomcat/bin/setenv.sh” and add the following two lines for your environment
      export JAVA_HOME=/opt/java/jdk1.6.0_25
      export CATALINA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=384m"
      
    • Now exit the editor by holding down the Control key and pressing the “X” key, type “Y” to save and then the Enter key to retain the same file name.
    • Start the Tomcat server by typing
      sudo ./startup.sh
    • Browse to http://<server_ip_address_here>:8080 to verify the installation is successful and running

    Install Open BlueDragon

    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp openbd.war  <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Login to your Ubuntu Server
    • Deploy the Open BlueDragon engine by typing
      sudo cp openbd.war /opt/tomcat/webapps/openbd.war
    • Browse to http://<server_ip_address_here>:8080/openbd to verify the installation is successful and running

    Install Railo

    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp railo-<full_file_name_here>   <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Login to your Ubuntu Server
    • Deploy the Railo engine by typing
      sudo cp railo<full_file_name_here>.war /opt/tomcat/webapps/railo.war
    • Browse to http://<server_ip_address_here>:8080/railo to verify the installation is successful and running

    Install Adobe ColdFusion 8

    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp coldfusion-8<full file name here>  <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Login to your Ubuntu Server
    • Make the ColdFusion installer executable by typing
      sudo chmod +x coldfusion-801-lin64.bin
    • Start the installer by typing
      sudo ./coldfusion-801-lin64.bin
    • Select the following options:
      • Read through the license agreement by pressing the Enter key
      • For install type, select “Developer Edition” using #3
      • For installer configuration, select “J2EE configuration (WAR file)” using #4
      • Un-select all of the sub-components by pressing 1, Enter, 2, Enter, 3, Enter, 4, Enter, 5, Enter
      • For Choose Install Folder, press Enter to accept the default
      • For Configure ColdFusion with OpenOffice, select 2, Enter
      • Enter a password for the ColdFusion administrator
      • For Enable RDS, select Y
      • Enter a pssword for RDS
    • Now that the installer has completed, we need to deploy the ColdFusion 8 engine by typing
      sudo cp /opt/coldfusion8/cfusion.war  /opt/tomcat/webapps/cfusion8.war
    • Browse to http://<server_ip_address_here>:8080/cfusion8/CFIDE/administrator/index.cfm to verify the installation is successful and running

    Install Adobe ColdFusion 9

    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp ColdFusion_9_<full file name here>  <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Login to your Ubuntu Server
    • Make the ColdFusion installer executable by typing
      sudo chmod +x ColdFusion_9_WWE_linux64.bin
    • Start the installer by typing
      sudo ./ColdFusion_9_WWE_linux64.bin
    • Select the following options:
      • Read through the license agreement by pressing the Enter key
      • For install type, select “Developer Edition” using #3
      • For installer configuration, select “J2EE configuration (WAR file)” using #4
      • Un-select all of the sub-components by pressing 1, Enter, 2, Enter, 3, Enter, 4, Enter, 5, Enter
      • For Choose Install Folder, press Enter to accept the default
      • For Configure ColdFusion with OpenOffice, select 2, Enter
      • Enter a password for the ColdFusion administrator
      • For Enable RDS, select Y
      • Enter a pssword for RDS

    Install Adobe ColdFusion 9.0.1 Update

    • Copy this file to your virtual machine.  If you’re on a Mac you’d use Secure File Copy to do this by opening your Terminal, then going to your Downloads directory (type “cd Downloads”) then type
      scp  ColdFusion_update_<full file name here>   <ubuntu_user_name_here>@<ubuntu_ip_address_here>:~
    • Login to your Ubuntu Server
    • Make the ColdFusion installer executable by typing
      "sudo chmod +x ColdFusion_update_901_WWEJ_linux64.bin
    • Start the installer by typing
      "sudo ./ColdFusion_update_901_WWEJ_linux64.bin
    • For the installer do the following:
      • Press Enter
      • Accept the license agreement
      • For Configuration Installation select #3
      • For EAR/WAR Location, enter the location you used in the previous installation
        • /opt/coldfusion9/cfusion.war
      • For the “Pre-Installation Summary”, press Enter
    • Now that the installer has completed, we need to deploy the ColdFusion 9 engine by typing
      sudo cp /opt/coldfusion9/cfusion.war  /opt/tomcat/webapps/cfusion9.war
    • Browse to http://<server_ip_address_here>:8080/cfusion9/CFIDE/administrator/index.cfm to verify the installation is successful and running

    Configuring Tomcat to startup with the system

    For one last bit of configuration, we’ll set the Tomcat server to start at system startup to make things easier for us.  To do this I’m going to borrow a script written by Aaron West here with a few mondifications following Jenson Taylor written here for my system.  To setup this file type the following

    sudo nano /etc/init.d/tomcat
    and then add the following to the contents:

    #!/bin/sh -e
    ### BEGIN INIT INFO
    # Provides: tomcat
    # Required-Start: $local_fs $remote_fs $network $syslog
    # Required-Stop: $local_fs $remote_fs $network $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # X-Interactive: true
    # Short-Description: Start/stop Tomcat as service
    ### END INIT INFO
    
    # setup the JAVA_HOME environment variable
    export JAVA_HOME=/opt/java/jdk1.6.0_25
    
    ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
    
    #set -e

    #. /lib/lsb/init-functions #test -f /etc/default/rcS && . /etc/default/rcS case $1 in start) echo -n "Starting Tomcat server" echo " " sh /opt/tomcat/bin/startup.sh echo ;; stop) echo -n "Stopping Tomcat server" echo " " sh /opt/tomcat/bin/shutdown.sh ;; restart) echo -n "Restarting Tomcat server" echo " " sh /opt/tomcat/bin/shutdown.sh echo " " sleep 6 echo " " sh /opt/tomcat/bin/startup.sh sleep 6 ;; esac exit 0

    Now we set this file to be executable and start at system startup by doing the following:

    cd/etc/init.d
    sudo chmod +x tomcat"
    sudo update-rc.d -f tomcat defaults"
    sudo shutdown -r now" to restart your server
    

    Now if you restart your system, the Tomcat server should come up automatically!

No comments: