Archive for July, 2009

pvscsi Linux module for vSphere under Debian

I just saw this URL for all you Debian users out there….you both know who you are !!
http://www.virtuallifestyle.nl/2009/06/using-the-vmware-paravirtual-scsi-controller-to-boot-a-debian-vm/

Tags:

Automating VMware Tools install after kernel update on RHEL / Centos

I came across this site when researching a way to automatically get the VMware tools re-installed on kernel updates.

http://www.tuxyturvy.com/blog/index.php?/archives/48-Automating-VMware-modules-reinstall-after-Linux-kernel-upgrades.html

There were plenty of comments but it seemed everybody had a different way of implementing how and when the script to update gets called. Plus, as there are so many init variations amongst the distributions, some SuSe stuff would not work on Red Hat.

Anyway, I have implemented yet another solution for Red Hat / CentOS. (I’m using 5.3).

I pinched this script from the very bottom of the site on tuxy.turvy.com.

#! /bin/bash
# Following lines auto-recompile VM Tools when kernel updated
 VMToolsCheckFile="/lib/modules/`uname -r`/misc/.vmware_installed"
 VMToolsVersion=`vmware-config-tools.pl --help 2>&1 | awk '$0 ~ /^VMware Tools [0-9]/ { print $3,$4 }'`

 printf "\nCurrent VM Tools version: $VMToolsVersion\n\n"

 if [[ ! -e $VMToolsCheckFile || `grep -c "$VMToolsVersion" $VMToolsCheckFile` -eq 0 ]]; then
 [ -x /usr/bin/vmware-config-tools.pl ] && \
 printf "Automatically compiling new build of VMware Tools\n\n" && \
 /usr/bin/vmware-config-tools.pl --default && \
 printf "$VMToolsVersion" > $VMToolsCheckFile && \
 rmmod pcnet32
 rmmod vmxnet
 depmod -a
 modprobe vmxnet
 fi

Save the above as file on your server called vmware-check-tools. Then do the following as root.

# cp vmware-check-tools /etc/init.d

# chmod 755 /etc/init.d/vmware-check-tools

# cd /etc/rc.d/rc3.d

# ln -s ../init.d/vmware-check-tools S09vmware-check-tools

All Done ! That is a zero-nine BTW.  S09. If you look in that rc3.d directory, you will notice lots of scripts starting with S and K and various numbers after them. This is how the init system starts/stops processes and in which order. We want the module check script to run before the network starts (so we load the vmxnet module). The network script is listed as S10network. So, I chose s09vmware-check-tools so it would run immediately before the network starts.

This actually works and I’ve rolled it out to all my CentOS boxes. There is no need for a K script as we don’t need to run the script when the server shuts down.

What the script does is check the current kernel misc module directory for the file, ‘.vmware_installed’. If it does not find it, vmware-config-tools.pl will be run with the default flag and then the .vmware_installed file will be created so the tools won’t re-install next boot (on the same kernel).

With the above, I’m only looking after runlevel 3.  That is, boot to the prompt. If you are one of those people who feel more secure booting to X windows, that would mean you are in runlevel 5. (Check /etc/inittab). In that case, you would want to create the symbolic link S09vmware-check-tools in the rc5.d directory.

Cheers

Installing WebObjects on RHEL Centos 5.3

Hi,

I like totally ripped most of these instructions from this site, Installing WO 5.3 or WO 5.4 on Linux , so please give your google adsense love clicks to it. Here is how we did it here…..the main differences are in our apache config and our developer wrote a better init.d script…..as quoted by him. NOW READ !!

0. Before you begin you will require:

  • Installed Sun JDK
  • Installed Apache and development header files
  • Add Dag’s rpmfusion repository. Do not enable it though, we will call it when we need it.

1. Get the WebObjects installer from mDimension’s Web site :

wget http://webobjects.mdimension.com/wolips/WOInstaller.jar

2. Install WebObjects 5.4.3 into /opt

sudo java -jar WOInstaller.jar 5.4.3 /opt

3. Create a user to run wotaskd and JavaMonitor (we are going to follow Mac OS X convensions here)

sudo groupadd appserverusr
sudo useradd -g appserverusr appserver

4. Fix permissions

sudo mkdir /var/log/webobjects
sudo chown appserver:appserverusr /var/log/webobjects
sudo chown -R appserver:appserverusr /opt/Local
sudo chown -R appserver:appserverusr /opt/Library
sudo chmod 750 /opt/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor
sudo chmod 750 /opt/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/Resources/SpawnOfWotaskd.sh
sudo chmod 750 /opt/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd

5. Edit .bash_profile for the appserver user and add the NEXT_ROOT environment variable

export NEXT_ROOT=/opt

6. Change to the appserver user and launch wotaskd and JavaMonitor to ensure everything is working

su - appserver
/opt/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
/opt/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &

7. You should now be able to browse to JavaMonitor at:

http://your.host.name:56789/

8. If you have made it this far you can shut down wotaskd and JavaMonitor and add in the scripts to bring them up on boot.

kill `ps aux | awk '/WOPort 56789/ && !/awk/ {print $2}'`
kill `ps aux | awk '/WOPort 1085/ && !/awk/ {print $2}'`

9. Download the attached start-up script and place it in /etc/init.d

10. Instruct the init script to run the script at boot

chkconfig --add webobjects
/etc/init.d/webobjects start

11. Download and unpack the Wonder source required for the apache adaptor

wget http://webobjects.mdimension.com/wonder/Wonder-latest-Source.tar.gz
tar zxvf Wonder-latest-Source.tar.gz
cd Wonder/Utilities/Adaptors

12. Edit the make.config file to set the environment we are building on

# Set the platform you are building on
ADAPTOR_OS = LINUX

13. Build and install the module

make
cd Apache2.2
apxs -i -a -n WebObjects mod_WebObjects.so

14. Add the following configuration to /etc/httpd/conf.d/webobjects.conf

<IfModule mod_WebObjects.c>

# Path to the Document Root of your Webserver,
# it should contain a directory named WebObjects
WebObjectsDocumentRoot /var/www/html

# You can change the 'cgi-bin' part of WebObjectsAlias to whatever you
# prefer (such as Apps), but the 'WebObjects' part is required.
WebObjectsAlias /cgi-bin/WebObjects

# We set a specific allow rule to prevent default restrictions from denying
# access to the module
<Location /cgi-bin/WebObjects>
    Allow from All
</Location>

# Point /WebObjects requests to the installed document root
Alias /WebObjects /var/www/html/WebObjects
<Location /WebObjects>
    Options -Indexes
    Allow from All
</Location>

# Here are the 3 possible configuration modes.
# The apache module uses one of them to get information
# about your deployed applications.
# 1085 is the reserved port on which wotaskd processes listen to by default.

# Host List Configuration
# wotaskd is started automatically on supported platforms,
# so this is the default mode.
# The apache module gets its configuration from the wotaskds
# listed on the configuration line
# For multiple hosts:
# WebObjectsConfig http://<name-of-a-host>:<port-on-a-host>,http://<name-of-another-host>:<port-on-a-host> <interval>
# For localhost:
WebObjectsConfig http://localhost:1085 10

# Multicast Configuration
# The apache module gets its configuration from all wotaskds
# that respond to the multicast call on the subnet
# WebObjectsConfig webobjects://239.128.14.2:1085 10

# File Configuration
# The apache module gets its configuration from one file
# WebObjectsConfig file://<path-to-a-xml-config-file> 10

# To enable public access to the WOAdaptorInfo page, uncomment the following line
WebObjectsAdminUsername public

# To enable the WOAdaptorInfo page with restricted access,
# uncomment the next two lines and set the user and password
# To access the WOAdaptorInfo page with restricted access, use
# a URL like: http://webserver/cgi-bin/WebObjects/WOAdaptorInfo?user+password.
# WebObjectsAdminUsername user
# WebObjectsAdminPassword password

# To change the logging options, read the following comments:
# The option name is "WebObjectsLog" and the first value indicates the path
# of the log file.
# The second value indicates the log level. There are five, in decreasing
# informational order:
#       "Debug",    "Info",    "Warn",    "Error",    "User"
#
# Note: To enable logging, touch '/tmp/logWebObjects'
# as the administrative user (usually root).
#
# The following line is the default:
WebObjectsLog /tmp/WebObjects.log Debug
</IfModule>

15. Copy the static content into the Apache document root

cd /opt/Library/WebObjects/WODocumentRoot
cp -R WebObjects /var/www/html/

all done!

The init.d script

————————————-

#!/bin/bash
#
# chkconfig: 345 90 10
# description: Provides WebObjects services

USER=”appserver”
NEXT_ROOT=”/opt”
WOTASKD_LOG=”/var/log/webobjects/wotaskd.log”
MONITOR_LOG=”/var/log/webobjects/JavaMonitor.log”

export NEXT_ROOT

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

# Check that networking is up.
[ “${NETWORKING}” = “no” ] && exit 0

start() {
echo -n “Starting wotaskd and Monitor: ”
daemon –user=$USER “$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 >> $WOTASKD_LOG 2>&1 &”
daemon –user=$USER “$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 >> $MONITOR_LOG 2>&1 &”
echo
}

stop() {
echo -n “Shutting down wotaskd and Monitor: ”
WOTASKD_PID=`ps aux | awk ‘/WOPort 1085/ && !/awk/ {print $2}’`
kill $WOTASKD_PID
MONITOR_PID=`ps aux | awk ‘/WOPort 56789/ && !/awk/ {print $2}’`
kill $MONITOR_PID
echo
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status $processname
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|status|restart}”
;;
esac

exit $RETVAL

———————————————–

Tags: