Saturday, November 08, 2008

Getting Wordpress to work with Server2Go

One more topic on Sever2Go and Windows and then I will get back to OpenSolaris.

WordPress is a a popular publishing platform with a focus on aesthetics, web standards, and usability. If you want to get it up and running on a USB stick using Server2Go then read on [see previous post about Server2Go].
  1. Download the latest version in this case 2.6.3

  2. Extract the files to your USB stick under the htdocs directory i.e. \server2go_a2\htdocs

  3. You should now have a directory structure which looks like server2go_a2\htdocs\wordpress

  4. You can now follow the instruction on the wordpress site, but they should go like this:
    • Rename the wp-config-sample.php file to wp-config.php
    • Open wp-config.php in your favorite text editor (Notepad) and edit the top few lines so they look this:
    • define('DB_NAME', 'server2go');
      define('DB_USER', 'root');
      define('DB_PASSWORD', '');
      define('DB_HOST', 'localhost');
      define('DB_CHARSET', 'utf8');
      define('DB_COLLATE', '');



    • Yes username is root and the password is blank.
    • I am using the existing database, but you could create a new one.
    • try the URL http://localhost:4001/wordpress/wp-admin/install.php and see what happens....



    • Well you are on your own now!!!!

Friday, November 07, 2008

Complete Webserver on a USB stick running on Windows (sorry)

I know I said I would never blog about Windows, but this piece of software is so great, I just have to mention it. Server2Go is a Webserver that runs out of the box without any installation and on write protected media if you wish, but I am going show you (step by step guide) how to get it up and running on a USB stick, so you can develop your website and all you need is a PC (or a Mac) and your USB stick:
  1. Download the software (Update 27/2/2012). There are a few different version but I went for "PHP 5.3.2, SQLite, MySQL 5.1.46 and Apache 2.2.15" (server2go_a22_psm.exe).
  2. Extract the downloaded file to your USB drive. It will take at least 200MB of space.
  3. Now you have to be careful since you need to edit a file.
    • You need to edit a file called pms_config.ini in the sub-directory \server2go_a2



    • Use any editor you like put I used Notepad.
    • You need to find the following variables and edit them to the new values.
      • StartLocal = 1
      • LocalMirror = 0
      • Port=8888 (You may have to change port number Update 27/2/2012)
  4. Now start the software by double clicking on \server2go_a2\Server2Go.exe
  5. With any luck the IE will start and will look like:
  6. With the above all done you can create wab pages in the directory \server2go_a2\htdocs and all changes you make to the MySQL will stay

Monday, October 27, 2008

Recap: Live Upgrade with ZFS root using SXCE (Nevada/OpenSolaris)

This is just a follow up to my previous blog entry "Live Upgrade with ZFS root using SXCE (Nevada)". I thought I would just do a quick recap, since I wanted to add a couple of points. For the full example and the output which is expected see the above entry.

Live Upgrade
  1. Preparation
  2. # lofiadm -a /export/iso/sol-nv-b99-x86-dvd.iso
    /dev/lofi/1
    # mount -o ro -F hsfs -o ro /dev/lofi/1 /mnt
    #
    pkgrm SUNWluu SUNWluzone SUNWlur SUNWlucfg
    #
    pkgadd -d /mnt/Solaris_11/Product SUNWlucfg SUNWlur SUNWluu SUNWluzone
  3. Create a new boot environment
    • If this is your first live upgrade then use this command (-c Assigns a name to the current current Boot Environment)
    # lucreate -c b97 -n b99
    # lucurr
    b97
    • Otherwise if you have done live upgrades before you do not need -c
    # lucreate -n b99
  4. Check it
  5. # lustatus
    Boot Environment Is Active Active Can Copy
    Name Complete Now On Reboot Delete Status
    -------------------------- -------- ------ --------- ------ ----------
    b95a yes no no yes -
    b97 yes yes yes no -
    b99 yes no no yes -
  6. Upgrade
  7. # luupgrade -u -n b99 -s /mnt
    # zfs list
    NAME                      USED  AVAIL  REFER  MOUNTPOINT
    rpool 151G 77.5G 41K /rpool
    rpool/ROOT 32.2G 77.5G 18K legacy
    rpool/ROOT/b95a 88.7M 77.5G 12.4G /tmp/.alt.luupdall.6066
    rpool/ROOT/b97 27.8G 77.5G 11.1G /
    rpool/ROOT/b97@20080820 7.77G - 9.51G -
    rpool/ROOT/b97@b97 8.57G - 12.4G -
    rpool/ROOT/b97@20080916 64.9M - 10.9G -
    rpool/ROOT/b97@b98 14.7M - 11.1G -
    rpool/ROOT/b99 4.34G 77.5G 11.2G /tmp/.luupgrade.inf.6336
    rpool/dump 2.97G 77.5G 2.97G -
    rpool/export 113G 77.5G 43.6G /export
    rpool/export/home 69.1G 77.5G 69.1G /export/home
    rpool/swap 2.97G 78.7G 1.75G -
  8. Make it your default boot enviroment
  9. # luactivate b99
  10. Reboot. WARNING must use init command
# init 6


Trouble Shooting:

  • - Error about mount point not empty during a live upgrade or after:
i.e.
ERROR: cannot mount '/.alt.tmp.b-nnb.mnt/': directory is not empty
or
cannot mount '/export/home': directory is not empty
This is most likely that there is a file or directory in this location or a mount point already exist.

Check only current system mounted (NO /.alt.. or /export/home) and then do some cleaning up (WARNING: before doing the "rm -ir" make sure you are happy delete these files)
# df -F zfs
/ (rpool/ROOT/snv_98 )
/export (rpool/export )
/export/home (rpool/export/home )
/rpool (rpool )


# zfs unmount /export/home
# ls -adR
/.alt.tmp.b-nnb.mnt /export/home
# rm -ir /.alt.tmp.b-nnb.mnt /export/home
# zfs unmount /export
# ls -adR /export
# rm -ir /export

# zfs mount /export
# zfs mount /export/home
or
# lumount NV95
# luunmount NV95

Thursday, August 21, 2008

Live Upgrade with ZFS root using SXCE (Nevada)

Couple of weeks ago I did a fresh install of "Solaris Express Community Edition snv_94" and selected ZFS root to see what it was like on my desktop. Then I thought I would upgrade to snv_95, but then I could not see any information about doing a live upgrade, what was I going to do!

After some searching I found a couple of old pages which hinted at it but not a full example, so there was only one way to find out......

Step-by-step guide.
  1. Download latest SXCE in this case sol-nv-b95-x86-dvd.iso
  2. Mount the ISO on the system
  3. # lofiadm -a /export/iso/sol-nv-b95-x86-dvd.iso
    /dev/lofi/1
    # mount -o ro -F hsfs -o ro /dev/lofi/1 /mnt
  4. Upgrade to the latest Live Upgrade Packages
  5. # pkginfo SUNWluu SUNWluzone SUNWlur SUNWlucfg
    application SUNWlucfg Live Upgrade Configuration
    application SUNWlur Live Upgrade (root)
    application SUNWluu Live Upgrade (usr)
    application SUNWluzone Live Upgrade (zones support)

    # pkgrm SUNWluu SUNWluzone SUNWlur SUNWlucfg
    # cd /mnt/Solaris_11/Product
    # pkgadd -d . SUNWlucfg SUNWlur SUNWluu SUNWluzone

  6. Now the fun! Create a new boot environment. lucreate has a new option -p which specifies the ZFS pool
  7. -p zfs_root_pool
    Specifies the ZFS pool in which a new BE will reside.
    This option can be omitted if the source and target BEs are within the same pool.
    e.g. lucreate -c b94 -n b95a -p newpool
    # lucreate -c b94 -n b95a
    Checking GRUB menu...
    System has findroot enabled GRUB
    Analyzing system configuration.
    Comparing source boot environment <b94> file systems with the file
    system(s) you specified for the new boot environment. Determining which
    file systems should be in the new boot environment.
    Updating boot environment description database on all BEs.
    Updating system configuration files.
    Creating configuration for boot environment <b95a>.
    Source boot environment is <b94>.
    Creating boot environment <b95a>.
    Cloning file systems from boot environment <b94> to create boot environment <b95a>.
    Creating snapshot for <rpool/root/snv_94> on <rpool/root/b95a@b95a>.
    Creating clone for <rpool/root/b95a@b95a> on <rpool/root/b95a>.
    Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/b95a>.
    Saving existing file </boot/grub/menu.lst> in top level dataset for BE <b95a> as <mount-point>//boot/grub/menu.lst.prev.
    File </boot/grub/menu.lst> propagation successful
    Copied GRUB menu from PBE to ABE
    No entry for BE <b95a> in GRUB menu
    Population of boot environment <b95a> successful.
    Creation of boot environment <b95a> successful.

  8. Check all is well
  9. # lustatus
    Boot Environment           Is       Active Active    Can    Copy
    Name Complete Now On Reboot Delete Status
    -------------------------- -------- ------ --------- ------ ----------
    b94 yes yes yes no -
    b95a yes no no yes -

    # zfs list
    NAME                       USED  AVAIL  REFER  MOUNTPOINT
    rpool 112G 116G 41K /rpool
    rpool/ROOT 14.7G 116G 18K legacy
    rpool/ROOT/snv_94 14.6G 116G 6.78G /
    rpool/ROOT/b95a 81.8M 116G 9.51G /.alt.tmp.b-Cz.mnt/

  10. Now do the upgrade
  11. # luupgrade -u -n b95a -s /mnt
    System has findroot enabled GRUB
    No entry for BE <b95a> in GRUB menu
    Copying failsafe kernel from media.
    Uncompressing miniroot
    Uncompressing miniroot archive (Part2)
    13364 blocks
    Creating miniroot device
    miniroot filesystem is <ufs>
    Mounting miniroot at </mnt/Solaris_11/Tools/Boot>
    Mounting miniroot Part 2 at </mnt/Solaris_11/Tools/Boot>
    Validating the contents of the media </mnt>.
    The media is a standard Solaris media.
    The media contains an operating system upgrade image.
    The media contains <Solaris> version <11>.
    Constructing upgrade profile to use.
    Locating the operating system upgrade program.
    Checking for existence of previously scheduled Live Upgrade requests.
    Creating upgrade profile for BE <b95a>.
    Checking for GRUB menu on ABE <b95a>.
    Saving GRUB menu on ABE <b95a>.
    Checking for x86 boot partition on ABE.
    Determining packages to install or upgrade for BE <b95a>.
    Performing the operating system upgrade of the BE <b95a>.
    CAUTION: Interrupting this process may leave the boot environment unstable or unbootable.
    Upgrading Solaris: 100% completed
    Installation of the packages from this media is complete.
    Restoring GRUB menu on ABE <b95a>.
    Adding operating system patches to the BE <b95a>.
    The operating system patch installation is complete.
    ABE boot partition backing deleted.
    PBE GRUB has no capability information.
    PBE GRUB has no versioning information.
    ABE GRUB is newer than PBE GRUB. Updating GRUB.
    GRUB update was successful.
    Configuring failsafe for system.
    Failsafe configuration is complete.
    INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot environment <b95a> contains a log of the upgrade operation.
    INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot environment <b95a> contains a log of cleanup operations required.
    WARNING: <1> packages failed to install properly on boot environment <b95a>.
    INFORMATION: The file </var/sadm/system/data/upgrade_failed_pkgadds> on boot environment <b95a> contains a list of packages that failed to upgrade or install properly.
    INFORMATION: Review the files listed above. Remember that all of the files are located on boot environment <b95a>. Before you activate boot environment <b95a>, determine if any additional system maintenance is required or if additional media of the software distribution must be installed.
    The Solaris upgrade of the boot environment <b95a> is partially complete.
    Installing failsafe
    Failsafe install is complete.

  12. Check status
  13. # lustatus
    Boot Environment           Is       Active Active    Can    Copy      
    Name Complete Now On Reboot Delete Status
    -------------------------- -------- ------ --------- ------ ----------
    b94 yes yes yes no -
    b95a yes no no yes -

  14. If you want to look at the new filesystem
  15. # zfs mount rpool/ROOT/b95a
    # df -F zfs
    /                  (rpool/ROOT/snv_94   ):243553838 blocks 243553838 files
    /export (rpool/export ):243553838 blocks 243553838 files
    /export/home (rpool/export/home ):243553838 blocks 243553838 files
    /rpool (rpool ):243553838 blocks 243553838 files
    .alt.tmp.b-Cz.mnt (rpool/ROOT/b95a ):243553838 blocks 243553838 files
    # zfs unmount rpool/ROOT/b95a

  16. Make it live
  17. # luactivate b95a
    System has findroot enabled GRUB
    Generating boot-sign, partition and slice information for PBE <b94>
    Saving existing file </etc/bootsign> in top level dataset for BE <b94> as <mount-point>//etc/bootsign.prev.
    WARNING: <1> packages failed to install properly on boot environment <b95a>.
    INFORMATION: </var/sadm/system/data/upgrade_failed_pkgadds> on boot environment <b95a> contains a list of packages that failed to upgrade or install properly. Review the file before you reboot the system to determine if any additional system maintenance is required.

    Generating boot-sign for ABE <b95a>
    Saving existing file </etc/bootsign> in top level dataset for BE <b95a> as <mount-point>//etc/bootsign.prev.
    Generating partition and slice information for ABE <b95a>
    Copied boot menu from top level dataset.
    Generating direct boot menu entries for PBE.
    Generating xVM menu entries for PBE.
    Generating direct boot menu entries for ABE.
    Generating xVM menu entries for ABE.
    Disabling splashimage
    Re-enabling splashimage
    No more bootadm entries. Deletion of bootadm entries is complete.
    GRUB menu default setting is unaffected
    Done eliding bootadm entries.

    **********************************************************************
    The target boot environment has been activated. It will be used when you
    reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
    MUST USE either the init or the shutdown command when you reboot. If you
    do not use either init or shutdown, the system will not boot using the
    target BE.
    **********************************************************************
    In case of a failure while booting to the target BE, the following process
    needs to be followed to fallback to the currently working boot environment:
    1. Boot from Solaris failsafe or boot in single user mode from the Solaris
    Install CD or Network.
    2. Mount the Parent boot environment root slice to some directory (like
    /mnt). You can use the following command to mount:

    mount -Fzfs /dev/dsk/c1d0s0 /mnt

    3. Run <luactivate> utility with out any arguments from the Parent boot environment root slice, as shown below:

    /mnt/sbin/luactivate

    4. luactivate, activates the previous working boot environment and indicates the result.

    5. Exit Single User mode and reboot the machine.

    **********************************************************************

    Modifying boot archive service
    Propagating findroot GRUB for menu conversion.
    File </etc/lu/installgrub.findroot> propagation successful
    File </etc/lu/stage1.findroot> propagation successful
    File </etc/lu/stage2.findroot> propagation successful
    File </etc/lu/GRUB_capability> propagation successful
    Deleting stale GRUB loader from all BEs.
    File </etc/lu/installgrub.latest> deletion successful
    File </etc/lu/stage1.latest> deletion successful
    File </etc/lu/stage2.latest> deletion successful
    Activation of boot environment <b95a> successful.
    #

  18. Reboot I see what happens.....

Wednesday, August 20, 2008

VirtualBox fails to run on snv_95 OpenSolaris

Just upgraded to snv_95 (SXCE: Nevada) and Virtualbox failed to start.

# VirtualBox
ERROR: 0 bytes read from child process

Failed to create the VirtualBox COM object.
Callee RC 0x80470007

After a panic, several reboots I found the web link which get me the solution:

http://www.virtualbox.org/ticket/1840

Summary:
========

Start VBoxSVC with environment variable LD_NODIRECT=1:

# cd /opt/VirtualBox
# mv VBoxSVC VBoxSVC.real
# cat > VBoxSVC
#!/bin/sh
LD_NODIRECT=1
export LD_NODIRECT
exec /opt/VirtualBox/VBoxSVC.real "$@"
^D
# chmod +x VBoxSVC

Friday, May 30, 2008

Solaris SMF manifest for mimedefang

I have been using MIMEDefang for some time and I thought I would write a Solaris SMF manifest so it would fit with the new Solaris 10 services.

I started off looking at a collection of existing manifest files from smtp-sendmail.xml to ssh.xml and a few online pages. So to convert your existing installation to use SMF do:

[updated 3rd July 2008 : init-script.in]

1) Rename the old startup files (you can delete them at a later date):
# ls /etc/rc?.d/*mimedefang
/etc/rc0.d/K38mimedefang /etc/rc1.d/K38mimedefang /etc/rc2.d/S82mimedefang /etc/rcS.d/K38mimedefang
# mv /etc/rc0.d/K38mimedefang etc/rc0.d/_K38mimedefang
# mv /etc/rc1.d/K38mimedefang etc/rc1.d/_K38mimedefang
# mv /etc/rc2.d/S82mimedefang etc/rc2.d/_S82mimedefang
# mv /etc/rcS.d/K38mimedefang etc/rc1.d/_S38mimedefang

2) Copy the startup file to a different location. You could put it in /lib/svc/method where all the Solaris ones are located, but I decided to keep it with the other mimedefang software (if you do change the location make sure you update the manifest file correctly):
# cp /etc/init.d/mimedefang /usr/local/mimedefang/bin/init-mimedefang

3) You can use your existing startup file and it will work with this manifest, but if you want to make full use of the manifest, then use this new version.

4) The download version is a replacement for the "examples/init-script.in" found in the source code directory, so you will need to to be put it in place before you build mimedefang (init-script is built when you run configure) and then copy init-script to in new location.
# cp  examples/init-script   /usr/local/mimedefang/bin/init-mimedefang
Changes are:
- Altered it to get rid of some none Solaris options.
- Altered the stop_it routines so it does a better job (better use of kill and more checking), which means that mimedefang will auto restart if it dies.
- Altered so it makes use of the properties of the service.
# diff -u init-script.orig init-script.in
--- init-script.orig    Thu Oct 18 17:46:05 2007
+++ init-script.in    Thu Jul 3 12:19:29 2008
@@ -1,15 +1,22 @@
#!/bin/sh
#
-# FreeBSD/NetBSD start/stop script for MIMEDefang.
+# Solaris 10 start/stop script for MIMEDefang.
#
# PROVIDE: mimedefang
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
+Modified 3rd July 2008
+    - added extra test in stop_it so mimedefang restarts after a "pkill -u defang"

-RETVAL=0
+. /lib/svc/share/smf_include.sh
+
+RETVAL=$SMF_EXIT_OK
prog='mimedefang'
-SPOOLDIR='@SPOOLDIR@'
+
+# Obtain SPOOLDIR (default=/var/spool/MIMEDefang)
+SPOOLDIR=`/usr/bin/svcprop -p config/spooldir $SMF_FMRI`
+SPOOLDIR=${SPOOLDIR:-'@SPOOLDIR@'}
PID="$SPOOLDIR/$prog.pid"
MXPID="$SPOOLDIR/$prog-multiplexor.pid"

@@ -40,7 +47,8 @@
# SOCKET=$SPOOLDIR/mimedefang.sock

# Run the multiplexor and filters as this user, not root. RECOMMENDED
-MX_USER=@DEFANGUSER@
+MX_USER=`/usr/bin/svcprop -p config/mx_user $SMF_FMRI`
+MX_USER=${MX_USER:-'@DEFANGUSER@'}

# Syslog facility
# SYSLOG_FACILITY=mail
@@ -51,6 +59,8 @@

# "yes" turns on the multiplexor relay checking function
# MX_RELAY_CHECK=no
+MX_RELAY_CHECK=`/usr/bin/svcprop -p config/mx_relay_check $SMF_FMRI`
+MX_RELAY_CHECK=${MX_RELAY_CHECK:-'no'}

# "yes" turns on the multiplexor HELO checking function
# MX_HELO_CHECK=no
@@ -57,9 +67,13 @@

# "yes" turns on the multiplexor sender checking function
# MX_SENDER_CHECK=no
+MX_SENDER_CHECK=`/usr/bin/svcprop -p config/mx_sender_check $SMF_FMRI`
+MX_SENDER_CHECK=${MX_SENDER_CHECK:-'no'}

# "yes" turns on the multiplexor recipient checking function
# MX_RECIPIENT_CHECK=no
+MX_RECIPIENT_CHECK=`/usr/bin/svcprop -p config/mx_recipient_check $SMF_FMRI`
+MX_RECIPIENT_CHECK=${MX_RECIPIENT_CHECK:-'no'}

# Set to yes if you want the multiplexor to log events to syslog
MX_LOG=yes
@@ -112,7 +126,8 @@

# Minimum number of processes to keep. The default of 0 is probably
# too low; we suggest 2 instead.
-MX_MINIMUM=2
+MX_MINIMUM=`/usr/bin/svcprop -p config/mx_minimum $SMF_FMRI`
+MX_MINIMUM=${MX_MINIMUM:-'2'}

# Maximum number of processes to run (mail received while this many
# processes are running is rejected with a temporary failure, so be
@@ -119,7 +134,8 @@
# wary of how many emails you receive at a time). This applies only
# if you DO use the multiplexor. The default value of 2 is probably
# too low; we suggest 10 instead
-MX_MAXIMUM=10
+MX_MAXIMUM=`/usr/bin/svcprop -p config/mx_maximum $SMF_FMRI`
+MX_MAXIMUM=${MX_MAXIMUM:-'10'}

# Uncomment to log slave status; it will be logged every
# MX_LOG_SLAVE_STATUS_INTERVAL seconds
@@ -173,29 +189,6 @@
     . @CONFDIR_EVAL@/$prog.conf
fi

-# BSD specific setup
-if [ -f /etc/rc.subr ]
-then
-    . /etc/rc.subr
-
-    name=$prog
-    rcvar=`set_rcvar`
-    # default to not enabled, enable in rc.conf
-    eval $rcvar=\${$rcvar:-NO}
-
-    load_rc_config $name
-
-    pidfile=$MXPID
-    procname=$PROGDIR/$prog-multiplexor
-    start_cmd="start_it"
-    stop_cmd="stop_it"
-    sig_reload="INT"
-    reread_cmd="reread_it"
-    # provide both "reload", the FreeBSD default, with a direct signal to
-    # the multiplexor, and "reread", the MIMEDefang default, using md-mx-ctrl
-    extra_commands="reload reread"
-fi
-
# Make sure required vars are set
SOCKET=${SOCKET:=$SPOOLDIR/$prog.sock}
MX_SOCKET=${MX_SOCKET:=$SPOOLDIR/$prog-multiplexor.sock}
@@ -288,11 +281,32 @@
     # Stop daemon
     printf "%-60s" "Shutting down $prog: "
     if test -f "$PID" ; then
-    kill `cat $PID`
-    RETVAL=$?
+    if kill -0 `cat $PID` > /dev/null 2>&1 ; then
+        kill `cat $PID`
+        RETVAL=$?
+    else
+        echo "mimedefang (`cat $PID`) has already been stopped."
+        # double check kill mimedefang , but all should be OK
+        # is this over the top?
+        RETVAL=$SMF_EXIT_OK
+        pkill -0 -u $MX_USER -x $prog > /dev/null 2>&1
+        if [ $? -eq 0 ]; then
+        pkill -u $MX_USER -x $prog
+        RETVAL=$?
+        fi
+    fi
     else
-    RETVAL=1
+    echo "mimedefang has already been stopped."
+    # double check kill mimedefang , but all should be OK
+    # is this over the top?
+    RETVAL=$SMF_EXIT_OK
+    pkill -0 -u $MX_USER -x $prog > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+        pkill -u $MX_USER -x $prog
+        RETVAL=$?
+    fi
     fi
+
     if [ $RETVAL = 0 ] ; then
    echo "[ OK ]"
     else
@@ -302,10 +316,30 @@
     # Stop daemon
     printf "%-60s" "Shutting down $prog-multiplexor: "
     if test -f "$MXPID" ; then
-    kill `cat $MXPID`
-    RETVAL=$?
+    if kill -0 `cat $MXPID` > /dev/null 2>&1 ; then
+        kill `cat $MXPID`
+        RETVAL=$?
+    else
+        echo "mimedefang-multiplexor (`cat $MXPID`) has already stopped."
+        # double check kill mimedefang-mult(iplexor) but all should be OK
+        # is this over the top?
+        RETVAL=$SMF_EXIT_OK
+        pkill -0 -u $MX_USER -x $prog-mult > /dev/null 2>&1
+        if [ $? -eq 0 ]; then
+        pkill -u $MX_USER -x $prog-mult
+        RETVAL=$?
+        fi
+    fi
     else
-    RETVAL=1
+    echo "mimedefang-multiplexor has already stopped."
+    # double check kill mimedefang-mult(iplexor) but all should be OK
+    # is this over the top?
+    RETVAL=$SMF_EXIT_OK
+    pkill -0 -u $MX_USER -x $prog-mult > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+        pkill -u $MX_USER -x $prog-mult
+        RETVAL=$?
+    fi
     fi
     if [ $RETVAL = 0 ] ; then
    echo "[ OK ]"


5) Create the manifest file (download version):
# cd /var/svc/manifest/network
# cat > mimedefang.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
  Created by Andrew Watkins 9th May 2008
  References:
    /var/svc/manifest/network
    http://opensolaris.org/os/community/smf
    http://www.sun.com/bigadmin
  Thanks to
    David F. Skoll
    Kimmo Jaskari
  Modified 14th May 2008
    - major rewrite
    - added properties
    - dependent on sendmail
-->

<service_bundle type='manifest' name='mimedefang'>
<service name='network/mimedefang' type='service' version='1'>
    <single_instance />

    <dependency name='fs-local' grouping='require_all' restart_on='none'
        type='service'>
        <service_fmri value='svc:/system/filesystem/local' />
    </dependency>

    <dependency name='network-service' grouping='require_all'
        restart_on='none' type='service'>
        <service_fmri value='svc:/network/service' />
    </dependency>

    <dependency name='system-log' grouping='optional_all'
        restart_on='none' type='service'>
        <service_fmri value='svc:/system/system-log' />
    </dependency>

    <dependent name='mimedefang_multi-user'
        grouping='optional_all' restart_on='none'>
        <service_fmri value='svc:/milestone/multi-user' />
    </dependent>

    <dependent name='mimedefang_sendmail'
        grouping='optional_all' restart_on='none'>
        <service_fmri value='svc:/network/smtp:sendmail' />
    </dependent>

    <instance name='default' enabled='false'>
    <!-- instance-specific properties, methods, etc. go here. -->
      <dependency name='config-file' grouping='require_all'
          restart_on='refresh' type='path'>
          <service_fmri
            value='file://localhost/etc/mail/mimedefang-filter' />
      </dependency>

      <exec_method type='method' name='start'
        exec='/usr/local/mimedefang/bin/init-mimedefang start'
        timeout_seconds='60' />

      <exec_method type='method' name='stop'
        exec='/usr/local/mimedefang/bin/init-mimedefang stop'
        timeout_seconds='120' />

      <exec_method type='method' name='refresh'
        exec='/usr/local/mimedefang/bin/init-mimedefang reread'
        timeout_seconds='60' />

      <exec_method type='method' name='restart'
        exec='/usr/local/mimedefang/bin/init-mimedefang restart'
        timeout_seconds='60' />

      <property_group name='startd' type='framework'>
        <propval name='ignore_error' type='astring'
          value='core,signal' />
      </property_group>

      <property_group name='config' type='application'>
        <stability value='Evolving' />
        <propval name='spooldir' type='astring' value='/var/spool/MIMEDefang' />
        <propval name='mx_socket' type='astring' value='mimedefang-multiplexor.sock' />
        <propval name='mx_user' type='astring' value='defang' />
        <propval name='mx_relay_check' type='astring' value='no' />
        <propval name='mx_sender_check' type='astring' value='no' />
        <propval name='mx_recipient_check' type='astring' value='no' />
        <propval name='mx_maximum' type='integer' value='10' />
        <propval name='mx_minimum' type='integer' value='2' />
      </property_group>

      <template>
        <common_name>
            <loctext xml:lang='C'>
            mimedefang filtering e-mail system
            </loctext>
        </common_name>
        <documentation>
            <doc_link name='mimedefang' uri='http://www.mimedefang.org' />
        </documentation>
      </template>

    </instance>
    <stability value='Unstable' />
</service>
</service_bundle>
^D
#


6) Check and setup the manifest:
# svccfg validate /var/svc/manifest/network/mimedefang.xml
# svccfg import /var/svc/manifest/network/mimedefang.xml

7) See if it all worked:
# svcs -a mimedefang
STATE          STIME    FMRI
disabled       16:58:48 svc:/network /mimedefang:default

8) Check what properties are available to be altered:
# /usr/bin/svcprop -p config mimedefang:default
config/mx_socket astring mimedefang-multiplexor.sock
config/spooldir astring /var/spool/MIMEDefang
config/stability astring Evolving
config/mx_maximum integer 10
config/mx_minimum integer 2
config/mx_relay_check astring no
config/mx_sender_check astring no
config/mx_recipient_check astring no
config/mx_user astring defang

9) Change any which need to be altered
# svccfg -s mimedefang:default setprop config/mx_maximum = 10
# svccfg -s mimedefang:default setprop config/mx_user = "defang5"
# svccfg -s mimedefang:default setprop config/mx_relay_check = "yes"
# svccfg -s mimedefang:default setprop config/mx_sender_check = 'yes'
# svccfg -s mimedefang:default setprop config/mx_recipient_check = "yes"
# svcadm refresh mimedefang


10) Start it up
# svcadm enable mimedefang
# svcs -a mimedefang
STATE          STIME    FMRI
online         16:59:48 svc:/network /mimedefang:default


11) Check the log file
# svcs -l mimedefang:default
fmri svc:/network/mimedefang:default
name mimedefang filtering e-mail system
enabled true
state online
next_state none
state_time Tue May 27 15:06:25 2008
logfile /var/svc/log/network-mimedefang:default.log
restarter svc:/system/svc/restarter:default
contract_id 284
dependency require_all/refresh file://localhost/etc/mail/mimedefang-filter (online)
dependency require_all/none svc:/system/filesystem/local (online)
dependency require_all/none svc:/network/service (online)
dependency optional_all/none svc:/system/system-log (online)

# cat /var/svc/log/network-mimedefang:default.log

References
smf(5) Frequently Asked Questions
Solaris Service Management Facility - Service Developer Introduction

Sunday, May 04, 2008

The "Sun Ultra" is dead. Long live the "Sun Ultra" !

Well it is the end of an Era after 10 years of using an Sun Ultra 10 at work I have finally obtained a Ultra 24 with a nice 22" display. About Time!





Sun Ultra 10 Workstation, Sun UltraSPARC[tm]-IIi 440 MHz, 512MB Memory, 9 GB IDE Disk Drive, Creator3D graphics (Got memory up 1GB, but after some deaths it ended at 384MB)

Sun Ultra 24 Workstation, Intel Core2 Quad Extreme QX6850 3.0 GHz, 6 GB Memory, 250 GB SATA Disk Drive, NVS290 Graphics

Sun Ultra 10 + 20" Sun Monitor
Grand Total = £2780 (May 1998)

Sun Ultra 24 £1171.18 + 4GB Memory £61.19 + 22" ViewSonic £192.86
Grand Total = £1425.23 (April 2008)

Friday, August 03, 2007

Improve OpenSolaris Performance

So, you downloaded the latest version of OpenSolaris and it is installed and running. Well there are a few (I will add more as they become aware to me) things you can remove to improve performance and slightly clean up your system.

Following can improve performace:
Remove the Update Manager GUI, since at this time it does nothing in OpenSolaris (removes the update manager process).
# pkgrm SUNWupdatemgrr SUNWupdatemgru
Remove the Basic Registration Application (improve the startup of JDS/GNOME).
# svcadm disable svc:/system/basicreg:default
# pkgrm SUNWbrgr SUNWbrg
Following cleans the system up:
Remove PPP.
# pkgrm SUNWpppdt SUNWpppdu SUNWpppd SUNWpppdr SUNWpppg
Remove the UUCP Utilities.
# svcadm disable svc:/network/uucp:default
# pkgrm SUNWbnur SUNWbnuu

Sunday, June 24, 2007

A complete Webserver in one download

So, you have your new machine and you need to get the Website up and running today, so what do you do:
  1. Solaris comes with the Apache server, but if you want php, then you have to download it.
  2. You obtain the software source from all the sites and start compiling..Get a life.
  3. You down load the packages from http://www.sunfreeware.com, but which ones and have you got all those extra Perl modules.
  4. Why can't I download one package and GO!
Well you can there is a great site called Cool Stack off the http://www.opensparc.net which have a few software packages which have been compiled and optimised for the Sun Hardware (SPARC /T1 or AMD).
  • CSKamp. This package includes Apache2, MySQL5 and PHP5 built to work together.
  • CSKmysql. This package includes a 64bit version of MySQL5 and is built with innodb.
  • CSKperl. This package includes Perl 5. Note that Solaris 10 ships with the same version of Perl. However, in addition to being better optimized, CSKperl includes several perl extensions.
  • CSKtds, CSKncurses, CSKphplibs. These packages are optional libraries required if you plan to use the corresponding PHP extensions.
  • CSKmemcached. This package includes memcached, a distributed object cache system.
  • CSKruby. This package includes ruby, rubygems and rails.
  • CSKsquid. This package includes Squid Web Proxy Cache.

So, all you need is download CSKamp (OK! I lied 3 downloads in my case) CSKperl and "CSKtds, CSKncurses,CSKphplibs (combined as one download)"

And, yes you install the packages and you are ready to go and to prove it I obtained MediaWiki and it installed and ran with out any other modules, not bad and saved me a lifetime.


NOTEs:
- check out the FAQ since it shows you had to start packages up as services
- disable APC or upgrade to later version. (again see FAQ)
- the coolstack has now got an OpenSolaris Project

Tuesday, May 29, 2007

Benchmarking Sun X4100 using SiSoftware Sandra

Just had delivery of a new Sun Fire X4100 M2 with (2x AMD Opteron Model 2216, 4x1GB PC2-5300 DDR2-667 memory) and I thought I would test its performance compared to other machines. I decided that the best way is to install windows 2003 x86 on it and then use SiSoftware Sandra Lite XI SP2 (version 1135). The following diagrams are the results when Sandra was run from a remote PC session and windows fully patched (red show winner)

(a) Sun Fire X4100 M2
2x AMD Opteron Model 2216 @2.4Ghz,
4x1GB PC2-5300 DDR2-667 RAM

(b) Viglen
Intel Core 2 CPU 6600 @ 2.4GHz
2GB of RAM

(c) Xen/OpenSolaris
Using the Viglen above I installed OpenSolaris B78 with windows installed via Sun Xvm/Xen.

Processor ArithmetricDhrystone ALU (higher is better)Whetstone iSSE3 (higher is better
x410035291 MIPS26161 MFLOPS
Viglen21734 MIPS15158 MFLOPS
Xen10377 MIPS7260 MFLOPS


Multi-Core EfficiencyInter-Core Bandwidth (higher is better)Inter-Core Latency (lower is better)
X41003890 MB/s116 ns
Viglen7060 MB/s 74 ns
XenN/AN/A


Physical DisksDrive Index (higher is better)Random Access Time (lower is better)
X410058 MB/s 7 ms
Viglen67 MB/s14 ms
Xen117 MB/s1 ms


Memory BandwidthRAM Bandwidth Int Buffered iSSE2 (higher is better)RAM Bandwidth Float Buffered iSSE2 (higher is better)
X410010982 MB/s10953 MB/s
Viglen 5011 MB/s 5041 MB/s
Xen4762 MB/s4784 MB/s


Memory LatencyRandom Memory Latency (lower is better)Speed Factor (lower is better)
X410091 ns72.2
Viglen99 ns74.2
Xen116 ns80


Cache and MemoryCombined Index (higher is better)Speed factor (lower is better)
X4100
25235 MB/s15.7
Viglen20174 MB/s33.3
Xen12570 MB/s17.1

Sunday, March 25, 2007

Building & Installing MediaWiki

I was asked the other day to install a Wiki and I thought I would publish the steps required to get the Wiki up and running. You most probably aware the wiki side is the easy part, since it requires a lot of other software installed on your system.

I will do this on a Solaris 10 SPARC system and since I believe in not installing to much non standard O/S software I will try to keep it down to the bare bones, but there is still a lot to do:

What I will require:
  1. Perl
    • I will install the non Sun version, since I want this more up to date, plus I have published an install guide before, but I will update this for latest release.
  2. MySQL
    • I have a choice of databases including Postgres and both come with Solaris 10, but again I will install my own version. I have more expertise with MySQL than Postgres, but that is my choice.
  3. PHP
    • This is the key for the wiki.
  4. Apache Server
    • I will use latest version 2.2 , even thought I have always used Version 1.3 before.
  5. MediaWiki
    • I have a little expertise of it and after some studying I believe it is the easies to setup (We will see!).

On route I am sure I will end up install other software, but this is the main tools to get my system up and running.

Tuesday, November 22, 2005

Installing Perl & Apache on Solaris 10

One of the first things you will want to setup on your new Solaris/OpenSolaris operating system is a web server, even though Solaris now comes with Perl and Apache installed by default, it is still worth installing your own version. New versions of Perl and Apache will always be ahead of the Solaris version, plus you will never damage the pre-installed version.

The procedure has been test on:
  • Solaris 10 3/05 SPARC & X86
  • Fully Patched
  • Installed Solaris Software Companion (/opt/sfw)
The following steps will install:
  • perl 5.8.7
  • basic perl modules used by apache
  • Apache 1.3.34 (Version 1 is still widely used)

Step 1) Setup environment vaiables (Using csh):
# setenv PATH \
    /usr/sfw/bin:/usr/local/bin:/usr/bin:/bin
# setenv PATH \
    ${PATH}:/usr/ccs/bin:/usr/sbin:/opt/sfw/bin:.
# setenv LD_LIBRARY_PATH \
    /usr/sfw/lib:/usr/local/lib:/opt/sfw/lib
Step 2) Configure and install perl (Install location will be /usr/local/perl587)
# gtar xfz perl-5.8.7.tar.gz
# cd perl-5.8.7
# rm -f config.sh Policy.sh
# sh Configure -Dcc='gcc -B/usr/ccs/bin/' \
    -Dprefix=/usr/local/perl587 -des
# make
# make test
# make install
# cd ..
# cp /usr/local/perl587/bin/perl /usr/local/bin

Step 3) Check perl has been install and is in your path.
# rehash
# which perl
/usr/local/bin/perl
# perl -V
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=solaris, osvers=2.10, archname=sun4-solaris
... a lot more stuff....
Step 4) Install some basic perl modules (down load from: http://search.cpan.org/)
# gtar xfz HTML-Tagset-3.04.tar.gz
# cd HTML-Tagset-3.04
# perl Makefile.PL
# make
# make test
# make install
# cd ..

# gtar xfz HTML-Parser-3.46.tar.gz
# cd HTML-Parser-3.46
# perl Makefile.PL
# make
# make test
# make install
# cd ..

# gtar xfz URI-1.35.tar.gz
# cd URI-1.35
# perl Makefile.PL
# make
# make test
# make install
# cd ..

# gtar xfz Compress-Zlib-1.41.tar.gz
# cd Compress-Zlib-1.41
# perl Makefile.PL
# make
# make test
# make install
# cd ..

# gtar xfz libwww-perl-5.803.tar.gz
# cd libwww-perl-5.803
# perl Makefile.PL -n
# make
# make test
# make install
# cd ..
Step 5) Set up mod_perl (Need to extract apache files first, since it updates them):
# gtar xfz apache_1.3.34.tar.gz
# gtar xfz mod_perl-1.29.tar.gz
# cd mod_perl-1.29
# perl Makefile.PL \
    APACHE_SRC=../apache_1.3.34/src \
    DO_HTTPD=1 USE_APACI=1 \
    PREP_HTTPD=1 EVERYTHING=1
# make
# make install
Step 6) Previous step did not compile apache. I prefer it that way:
# ./configure --prefix=/usr/local/Apache/1334 \
    --enable-module=info \
    --enable-module=most --enable-shared=max \
    --enable-module=status \
    --enable-module=so \
    --activate-module=src/modules/perl/libperl.a

# make
# make install
Step 7) We will pause here, since if you try to start the apache server you will get an error if this is on a SPARC platform.
# /usr/local/Apache/1334/bin/apachectl start

Syntax error on line 210 of /usr/local/Apache/1334/conf/httpd.conf:

Cannot load /usr/local/Apache/1334/libexec/mod_negotiation.so into server: ld.so.1: httpd: fatal: relocation error: file /usr/local/Apache/1334/libexec/mod_negotiation.so: symbol __floatdisf: referenced symbol not found
/usr/local/Apache/1334/bin/apachectl start: httpd could not be started

Step 8) SKIP to "step 9" if you are on a x86 platform.
# cd src/modules/proxy
# ld -G -o mod_proxy.so mod_proxy.lo \
    `gcc -print-libgcc-file-name`
# cd ../standard
# ld -G -o mod_negotiation.so mod_negotiation.lo \
    `gcc -print-libgcc-file-name`
# cd ../../..
# make
# make install
Step 9) Test that it all works
# /usr/local/Apache/1334/bin/apachectl start
http://localhost:8080
You will need to read other documention about configurations changes you can make to apache, but now you have a working version to use.

Hope it will helped some people and if there are any errors or commenst please be in contact.

Wednesday, October 26, 2005

Installing StarOffice 8 on a Solaris NFS client (workstation)

As you are all away StarOffice 8 is now out it looks good, but you may find out that integrating the software into GNOME/CDE on a Solaris/OpenSolaris workstation after install the software on a NFS server. If you are happy to install the whole (400MB+) on every workstation then you don't have to worry about this problem.

With StarOffice 7 you could install the software once on your network and then run the simple command on all workstations "/usr/dt/bin/dtappintegrate -s /opt/staroffice7" which would integrate it with your windows system. This feature was replace in the new version with packages, which seems a better idea, but it does not work 100%, since it needs a bit of manual work.

The procedure you will require is:

1) Install StarOffice 8 on your NFS server. (Keep the unpacked files, usually located in
/var/tmp/unpack_staroffice/packages)

2) On your workstation mount the software filesystem i.e.
# mount server:/opt/staroffice8 /opt/staroffice8
# mount server:
/opt/adabas /opt/adabas

3) Install the following packages if they don't already exists on your system (location can be found from step 1): Solaris 10 already has then installed so you can skip this.
SUNWj5cfg JDK 5.0 Host Config. (1.5.0_03)
SUNWfreetype2 FreeType2 Font library
SUNWj5rt JDK 5.0 Runtime Env. (1.5.0_03)

4) Install the following packages:
SUNWstaroffice-desktop-integratn Desktop integration for StarOffice 8
SUNWstaroffice-shared-mime-info shared mime info updates for StarOffice 8

5) Next step is a manual process to merge the contents of /etc/mailcap and /etc/mime.types on the client with the ones on the server. This was automaticly done on the server installation, since the package "
SUNWstaroffice-desktop-int-root" did it. But this can not be installed on a client: [I just copied it from the server]
/etc/mailcap
/etc/mime.types
6) Finally, add a link:
cd /etc
ln -s /opt/staroffice8 staroffice8

I have talked to Sun about this problem and I belive they are going to look into it. I guess they did not bother about this setup thinking that we would install all the software on all workstation,
which I guess what the PC people are going to do, but UNIX people don't do this!

Hope this helps others.

Thursday, October 13, 2005

My First Blog

This is nothing to read here, but give me time and I am sure there will be more.