Setting up the developer stack issues

There’s a great post on Coding Horror about Configuring the Stack.Basically the gripe is with the complexity of installing the typical developer stack, in this case on Windows, using Visual Studio. My VS setup isn’t vastly different to the one Jeff mentions, and I have similar issues with the other stacks I use. I’ve just set up the Ultra3 mobile workstation again for building MySQL and other stuff on, and it took about 30 packages (from Sun Freeware) just to get the basics like gcc, binutils, gdb, flex, bison and the rest set up. It took the best part of a day to get everything downloaded, installed, and configured. I haven’t even started on modules for Perl yet. The Eclipse stack is no better. On Windows you’ll need the JDK of your choice, plus Eclipse. Then you’ll have to update Eclipse. Then add in the plugins and modules you want. Even though some of that is automated (and, annoyingly some of it is not although it could be), it generally takes me a few hours to get stuff installed. Admittedly on my Linux boxes it’s easier – I use Gentoo and copy around a suitable make.conf with everything I need in it, so I need only run emerge, but that can still take a day or so to get everything compiled.Although I’m sure we can all think of easier ways to create the base systems – I use Parallels for example and copy VM folders to create new environments for development – even the updating can take a considerable amount of time. I suggest the new killer app is one that makes the whole process easier.

Setting a remote key through ssh

One of the steps I find myself doing a lot is distributing round an ssh key so that I can login and use different machines automatically. To help in that process I created a small function in my bash profile script (acutally for me it’s in .bash_aliases):

function setremotekey{ OLDDIR=`pwd` if [ -z "$1" ] then echo Need user@host info fi cd $HOME if [ -e "./.ssh/" ] then cat ./.ssh/ |ssh $1 'mkdir -p -m 0700 .ssh && cat >> .ssh/authorized_keys' else ssh-keygen -t rsa cat ./.ssh/ |ssh $1 'mkdir -p -m 0700 .ssh && cat >> .ssh/authorized_keys' fi cd $OLDDIR}

To use, whenever I want to copy my public key to a remote machine I just have to specify the login and machine:

$ setremotekey mc@narcissus

Then type in my password once, and the the function does the rest. How? Well it checks to make sure I’ve entered a user/host (or actually just a string of some kind). Then, if I haven’t created a public key before (which I might not have on a new machine), I run the ssh-keygen to create it. Once the key is in place, I output the key text and then use ssh to pipe append that to the remote authorized_keys file, creating the directory along the way if it doesn’t exist. Short and sweet, but saves me a lot of time.

Geekbench results for iMac 24

I’ve just completed running Geekbench results for my 24″ iMac (3GB, Intel T7600, 2.33GHz) and the Sun Ultra 20M2 I have on test (4GB, AMD Opteron 1200 2.8GHz).The overall rates are interesting: iMac: 246*U20M2: 273.5*The U20M2 is slightly faster, although in use I think it’s much faster. I’m still completing some tests on the U20 under different operating systems on the U20 to see whether there is some advantage to different OS on the U20M2. *: The iMac is updated to the latest BIOS and latest updates, with other applications not running*: The U20M2 is updated to the BIOS and drivers (from the 1.4 driver update CD), with other applications not running

Parallels Update

Parallels for Mac has been updated, but its the stuff beyond the highlight elements that I find most interesting.The headline elements are:

  • Support for the new Mac Pro (and up to 3.5GB RAM
  • Support for Mac OS X 10.5 (Leopard)
  • Experimental support for Vista

That’s all great, and I’m just installing Vista beta 2 on the iMac as I type this on the MBP. However, for me the key elements are:

  • Solaris guest OS no longer hangs after suspend/resume – this was a really annoying issue that begged me no end. Although my iMac 17″ stays on full time, my MBP is set to sleep after an hour, but leaving it alone while I’m updating Solaris 10 or running tests would mean that I’d have to force a reboot and sometimes start again.
  • Solaris doesn’t work with more than one virtual disk fix – this was particularly annoying, as I’ve been playing with ZFS, and having multiple, virtual hard disks to toy with would have been much better than playing with partitions.

So far, the new version seems great. Being able to play with ZFS (even with expanding disks) is fantastic. I’ve been too busy to let the machine sleep and trigger the freezing problem.

Getting Solaris 10 working in Parallels

I’ve just been sent the latest version of Solaris 6/06 release) and wanted to get it working in a Parallels virtual machine.Not everything is plain sailing, but with a combination of past experience and a few quick configuration changes you can get it working fine. Basic installationThe key to getting the basic installation working fine is to ensure you choose and set the correct options when configuring the disk device. The Solaris Installer will see the virtual disk, but for some reason wont automatically perform the fdisk partition for you. Once you get to the option that shows the disk drives and default partition, make sure you go through the FDISK configuration and create a single partition. This will give Solaris the block device it needs to then create it’s own partition map. NetworkingOnce booted up, you’ll need to get the networking driver that comes with the Parallels boot disk installed. Attach the vmtools.iso disk (on Mac OS X this is located in /Library/Parallels/Tools); it should automount in Solaris. Navigate through to the network/Solaris directory and run the script to install the driver and configure the IP address, netmask and gateway. You’ll need to reboot. Once rebooted, copy /etc/nsswitch.dns to /etc/nsswitch.conf to enable DNS searches for hosts, and then edit /etc/resolv.conf with your domain name (optional) and nameserver information. For example, mine reads:

domain mcslp.prinameserver

X11 configurationThe default X11 configuration will often work fine for the display and keyboard, but the mouse fails to be configured. You need to configure the mouse to use the /dev/kdmouse device and operate as a PS/2, not USB, mouse. You can do this by hand by editing the /etc/X11/.xorg.conf file, or you can create your own, or you can download this file and copy it into /etc/X11/xorg.conf.If you want to go through the process yourself, first run kdmconfig and set it to use run /usr/X11/bin/xorgconfig – you’ll need to go through each step (which involves setting up the mouse, keyboard and display). Select the PS/2 mouse option and give the driver name. Choose an appropriate keyboard layout (I’m using the 102-key international layout and haven’t had any issues yet. For the display driver, configure a multisync monitor (using huge manual horizontal and vertical refresh values) or using the largest of the options provided, and select VESA as the display adaptor type, setting an appropriate amount of video RAM etc. to get the display depth and size you want. All set!That should be everything – you can see a sample of Solaris 10 running in Parallels below.



Stepped execution with cron and at

I had a query from a reader today as a follow up to my System Administrators Toolkit: Time and event management article at developerWorks:

How do I execute a script at a specific interval, for example 28 days, rather than on a specific day or date?

It is the one limitation of cron that it doesn’t support such an interval, although there are some systems (including many Linux installations) that provide an alternative method. There are some solutions to the problem that will work on any platform that uses the cron/at system.One way is to run the script every 7 days, and have it record how many times it’s been called in a file. All you have to do is, in the script, load the current count, work out if this is the fourth time, and run the script accordingly. For example: count=`cat counter`count=`expr $count + 1`if [ $count -eq 4 ]then echo 0 >counter echo 4th time called, going for it # Do everything elseelse echo $count >counterfiI suggest you put the counter file into a usable location, but you get the idea.The other alternative is to use at, rather than cron, and then add a line in the script to execute the script again in 28 days time. For example, using this line at the end of your script: at 9pm + 28 days <myscript .shBecause you are specifying the same time, but a different day, this will execute at the same time every 28 days. If your script takes a long time to process and you run it, for example, at 23:59, put the ‘at’ line at the start of the script, rather than the end, so that the request gets registered on the same day.