Thursday, July 14, 2011

Install Mule ESB on CentOS Base Install

Install Mule ESB on CentOS Base Install


#Updates...
yum update


#Few packages I like throwing on every system (optional)
yum install htop mlocate
updatedb


#Installing the rpmforge repo (optional)
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm


#Install JRE
cd /tmp
wget -O jre.bin "http://download.oracle.com/otn-pub/java/jdk/6u26-b03/jre-6u26-linux-x64-rpm.bin"
chmod +x jre.bin
./jre.bin


#Edit profile to insure correct pathing
vi /etc/profile



    export JAVA_HOME="/usr/java/latest"
    export JAVA_PATH="$JAVA_HOME"
    export PATH="$PATH:$JAVA_HOME:$MAVEN_HOME/bin:$MULE_HOME/bin"
    export MAVEN_HOME="/opt/apache/maven/bin"
    export MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=256m'
    export MULE_HOME="/opt/mule"



source /etc/profile


**Note

You must also endorse the JDK with a proper JAXP (Java API for XML Processing) implementation. To do this, download Apache Xerces and Xalan and drop the JARs into your JVM's jre/lib/endorsed directory. If that directory does not yet exist, create it.

wget http://apache.mirrors.hoobly.com/xml/xalan-j/xalan-j_2_7_1-bin-2jars.tar.gz
wget http://apache.mirrors.hoobly.com//xerces/j/Xerces-J-src.2.11.0.tar.gz
tar xzvf xalan-j_2_7_1-bin-2jars.tar.gz
tar xzvf Xerces-J-src.2.11.0.tar.gz
cp xerces-2_11_0/*.jar $JAVA_HOME/lib/endorsed/
cp xalan-j_2_7_1/xalan.jar $JAVA_HOME/lib/endorsed/



#Install Maven
mkdir /opt/apache
cd /opt/apache

wget http://newverhost.com/pub//maven/binaries/apache-maven-2.2.1-bin.tar.gz
tar xzvf apache-maven-2.2.1-bin.tar.gz
ln -s apache-maven-2.2.1 maven
Check the installation:
mvn --version
Create a Maven repository directory with no spaces in the path

mkdir /opt/apache/maven-repo


#Setup Mule ESB
cd /usr/src
wget http://s3.amazonaws.com/MuleEE/mule-ee-distribution-standalone-mmc-3.1.2.tar.gz
tar xzvf mule-ee-distribution-standalone-mmc-3.1.2.tar.gz
cp -r mule-enterprise-standalone-3.1.2 /opt/mule
cd /opt/mule/bin
./populate_m2_repo /opt/apache/maven-repo


#import mule license

mule -installLicense ~/license_esb.lic








Attach ESB device to CentOS


These instructions on how to mount an Amazon EBS volume apply to CentOS Linux specifically but with little modification can be applied to all Linux distributions. By attaching EBS volumes (aka. disks) to your instance you can get around the majority file space issues that might encounter when hosting popular websites or those which contain a lot of data (e.g. image galleries, music sites, podcasts, etc.)
  1. Note down the instance id of the instance you want to add more storage to
  2. In your AWS account go to the volumes link (under Elastic Block Store) click the Create Volume Button and choose how big you want this device to be.
  3. Attach the new EBS volume to your instance by right clicking it and choosing Attach Volume. Select the instance id from the list that you noted down in step 1. and give the new device a name to reference it on the instance, e.g. /dev/sdf
  4. Login into your instance on the command line and do and run (# represents the command prompt):
    # ls /dev
    You should see that /dev/sdf has been created for you
  5. Format /dev/sdf by running:
    # mkfs.ext3 /dev/sdf
    It will warn you that this an entire device. You should type y to allow the process to continue unless you want to create specific partitions on this device
  6. Create a directory to mount your new drive as on the filesystem, for example we’ll use /files:
    # mkdir /files
  7. Add a reference in the fstab file to mount the newly formatted drive onto the /files directory by running the following command:
    #  echo "/dev/sdb /files ext3 noatime 0 0" >> /etc/fstab
  8. Mount the drive by running:
    # mount /files
  9. Check your drive has mounted correctly with the expected amount of file space by running:
    # df -h /files

Friday, July 8, 2011

Webistrano sh: ruby: command not found

I was attempting to push a deployment and got nothing more than a spinning wheel. I checked the production.log for webistrano  and found that I was getting an error.


sh: ruby: command not found

It took me a little digging, but I did find the fix as well as an explanation.


The cause:
Since Apache is not started from the shell, it does not load the environmental variables.
The fix:
Add the following to your apache global config to have apache load them at start.

# Load environmental variables:
SetEnv PATH /usr/bin:/usr/local/bin:/bin
SetEnv LD_LIBRARY_PATH /opt/whatever/lib

Credit goes to: http://blog.phusion.nl/2008/12/16/passing-environment-variables-to-ruby-from-phusion-passenger/