Create a Linux Boot ISO image to start via Kickstart

Getting tired of creating new VM’s, and don’t want to clone for a particular reason but want them standardized? Easy. By creating a boot image that immediately starts a kickstart installation, you can completely automate creating a VM regardless of virtualization solution your using.

To create the isolinux boot image:

Mount the DVD image.

mount -o loop /path/to/dvd.iso /mnt

Copy the data locally.

rsync -av /mnt/isolinux [where ever]

Edit the isolinux.cfg file to update and point to proper kickstart location, and make it auto start by setting prompt to 0.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
default linux
prompt 0
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ks=nfs:192.168.0.1:/mnt/vg1/iso/kickstart/centos55_text.ks
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -

Create a simple script in the isolinux directory to do the heavy lifting.

1
2
3
4
5
6
#!/bin/sh
ISO_NAME=centos55_boot.iso
# Remove the old iso.
rm -f $ISO_NAME
# Make the image.
mkisofs -o $ISO_NAME -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T $PWD

Kick it off and you should now have a viable boot image. Once you boot the newly created guest, just boot using the new image and it will automatically start your kickstart installation.

20. January 2011 by Jason
Categories: Linux, Virtualization | Tags: , , | 6 comments

OpenAM Apache Web Agent

Make sure you set the Encode Cookie Value to Yes or True. If it’s not able to be modified, it’s an inherited setting that you will need to change. If you don’t, you’ll get a 500 error once a successful login has occurred.

27. December 2010 by Jason
Categories: Java | Tags: | Leave a comment

Update Postgres in Ubuntu

The Postgres website download page doesn’t do a great job of documenting how to keep PG up to the latest release. Even for those of us who are using 10.10, the standard repositories still point to older 8.X versions. To ensure that you have access to the latest version of PostgreSQL in Ubuntu, install Martin Pitt’s backports PPA. If you are running Ubuntu >= 9.10 you can do this with one simple command:

sudo add-apt-repository ppa:pitti/postgresql

Once that is done, you may need to enable the updates to use backports. In Synaptic, open Settings -> Repositories and select the Updates tab. Make sure that “Unsupported updates” is checked.

Then just update as usual, and Postgres will be updated to the latest and greatest.

30. November 2010 by Jason
Categories: Linux | Tags: | Leave a comment

Regex Recipes

Since I went through the time to create these, I might as well document a few of them for myself and anyone else who might be looking for it. As I refine and author more, I’ll add them here.

Phone Number Validation

This would be useful to validate phone numbers of customers, clients or prospects. This only validates the 10 digit phone number that does not have parenthesis and dashes. Minor modifications would be necessary to validate with those formatting characters included. (via NANPA.)

^(8(?:00|88)|([2-9])(?!\2{2}|9[\d]|00|11)[\d]{2})([2-9&&[^5]][\d]{2}|(?:5(?!55)[\d]{2}))([\d]{4})$

[UPDATE: Didn't like what I had before and this should be a smaller, more optimized, version.]
This regex covers:

  • All ERC (Easily Recognizable Codes) which would include codes like 333,444,555, etc.
  • Allowance for toll-free numbers (800,866,877,888, etc.)
  • ERC Service codes 211,311,411,511,611,711,811,911.
  • Unallocated and/or premium codes (200,300,400,500,700,900, etc.)
  • Standard area codes from 201 to 989.
  • Removal of 555 Central Office prefix.

If you want to give these a try there are a number of online utilities, but RegExr is one of my favorites.

24. August 2010 by Jason
Categories: Development | Tags: | Leave a comment

Install VirtualBox Guest Additions on CentOS 5.x

This has been documented many times before, but for some reason installing VirtualBox guest additions on CentOS is a pain. To install them:

  1. yum install kernel-devel gcc
  2. either ln -s /usr/src/kernel/[current version] /usr/src/linux or
  3. export KERN_DIR=/usr/src/kernel/[current version]
  4. Then the usual ./VBoxLinuxAdditions-[arch].run

For whatever reason, the VirtualBox guest additions still expect to find the kernel headers in /usr/src/linux and not the location in which they are really installed to.

10. August 2010 by Jason
Categories: Virtualization | Tags: , | 2 comments

Really Using OpenSSO with Salesforce

This subject has been covered many times before, but one thing that is not easily identified in ANY of them is that for this to work properly, you must be using a version of OpenSSO express, not enterprise. You’ll bang your head against a rock looking for a solution.

The problem is that OpenSSO express doesn’t exist anymore. Well not in a form supported/provided by Oracle. ForgeRock now has it and it’s been rebranded to OpenAM. The good news is that all of these tutorials and documents still are valid — so long as you actually got the right piece of software.

I wish that when folks write documentation they include specifics about the software they are writing about. But then again, maybe it’s just me…

09. July 2010 by Jason
Categories: Salesforce | Tags: , | Leave a comment

SalesForce.com JAX-WS & Netbeans

The process for using SalesForce.com (SFDC) webservices in Netbeans isn’t as intuitive as you would think. Most of the SFDC documentation examples are built using Apache Axis vis-a-vis JAX-WS. The good news is that it’s possible to get Netbeans (and therefore JAX-WS) to properly build a WS client for SFDC.

Once you’ve downloaded your organizations enterprise or partner WSDL, in Netbeans, right-click on the project and select New -> Web Service Client (if it’s not there then New -> Other -> Web Services Category, and then Web Service Client). Select Local File and Browse to the location of your downloaded WSDL. Specify your package and leave the Client Style as JAX-WS and “Generate Dispatch Code” unselected.

Netbeans will attempt to do it’s thing and fail with an error – however, it’s not the only thing standing between you and a working web service client in Netbeans. Below is the error that I received.



In this case, it’s complaining about a ComplexType and element that share the same name. There are two different ways to solve the problem and really only one that works with Netbeans. To properly fix the issue (and have Netbeans “see” the fix) you need to create a JAX-WS binding document to prevent the naming collision from occurring. To do this create a new file and cut and paste this into it. You may have to adjust the @targetNamespace='urn:enterprise.soap.sforce.com' to whichever version (enterprise or partner) your using.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<bindings
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns="http://java.sun.com/xml/ns/jaxws" wsdlLocation="../wsdl/enterprise.wsdl">
  <bindings
    node="//xsd:schema[@targetNamespace='urn:enterprise.soap.sforce.com']">
    <jaxb:globalBindings
      underscoreBinding="asCharInWord" />
    <jaxb:schemaBindings>
      <jaxb:nameXmlTransform>
        <jaxb:typeName suffix="Type" />
      </jaxb:nameXmlTransform>
    </jaxb:schemaBindings>
  </bindings>
  <enableWrapperStyle>false</enableWrapperStyle>
  <enableAsyncMapping>false</enableAsyncMapping>
</bindings>

But we’re not done quite yet. Even though the first attempt failed, Netbeans created a new “Web Service References” node in the Projects tree. If you expand that node, you’ll see your webservice. Right-click on the service and select “Edit Web Service Attributes”. Select the “WSDL Customization” tab and scroll all the way to the bottom section named “External Binding Files”. Expand it, and click “Add”. Answer “Yes” to the dialog and then find the xml file you created earlier that contained the binding changes.

Once you select “OK”, a dialog will appear indicating that a refresh of the client is underway. At that point, Netbeans will attempt to re-create the client. If all goes well you should have a working SFDC client in Netbeans.

[UPDATE 1]

The security model in the SFDC API is interesting. In order to properly utilize the service, you must do two things after logging in. One, re-point to a URL that actually contains your organization, and two, make all subsequent calls to that new URL with a session ID that is provided as a result of the login process. The good thing is it’s documented. The bad thing is it’s not documented well at all for JAXWS. What follows is a condensed version of what it took to make it really work.

Repoint to the correct URL

You log into one URL and as part of the LoginResponse you get the real URL of your organization. All subsequent calls made after logging in must use this new URL. It’s in the documentation and described well. However, the redirection of subsequent calls requires the user (caller) to change the ENDPOINT_ADDRESS_PROPERTY to the new URL. The SFDC documentation that uses Axis, shows that with Axis the ability to manipulate a SOAP binding property is relatively straightforward. Unfortunately it’s not quite so simple with JAXWS.

All of the documentation regarding using JAXWS in SFDC focuses on the use of the non-standard com.sun.xml.internal.ws.developer.WSBindingProvider to get access to the SOAP binding properties to insert the new endpoint URL once the login has successfully completed. For some reason, if you attempt to use this from glassfish, the downcast of the port to WSBindingProvider causes an exception preventing it from working properly and successfully getting the port to re-point to the proper endpoint URL. However, I was able to figure a way around the WSBindingProvider to get access to the SOAP header to set the proper endpoint address. I’ll detail that step in another post.

Provide the proper session ID

This workaround was somewhat simpler even though the reasons are just a complex. The short answer is that the SOAP headers are not implicitly defined in the Salesforce.com WSDL. Because the SOAP headers are defined in the WSDL binding section instead of the portType section, they don’t become available and you won’t be able to get set the proper session ID wihout getting really creative. The solution is very straightforward. In the WSImport Options tab where you set the jaxb options, set one more WSImport Option as well. Add in xadditionalHeaders and true.

When done successfully, the method signatures will now include a parameter for the SessionHeader (where you set the sessionID).

I’m going to show a full working example of all of this in a subsequent post for those who want/need more information.

[UPDATE 2]

Upon further testing it appears that wsimport will disregard the -XautoNameResolution if you also provide a mapping file because they’re actually attempting to do the same thing. Furthermore, if you just use -XautoNameResolution without the mapping, wsimport will work properly however Netbeans doesn’t “see” the fix and still complains even though you can compile and run. Removing the references for -XautoNameResolution for now.

Enjoy.

26. February 2010 by Jason
Categories: Development, Java | Tags: , , | 12 comments

The problem with technical books.

Introduction

Technology books (especially programming books) are a required item for most software professionals and my office at work is littered with them. At any given time there are a dozen books that I may actively reference on a day-to-day basis for the projects that I’m working on. My main library, literally, is my home. I cycle books in and out of my house with the regularity of a public branch library; albeit one dedicated to technology. I have racks of books in my basement where they are shelved and ready to be used when needed. While not necessarily grouped and classified using structure of the Dewey Decimal System, it’s good enough for me.

If you’ve been around software long enough you’ve been exposed to the almost universal maxim regarding software — it almost never stops changing. Software changes and grows, sometimes organically, sometimes in rough and abrupt ways, but rarely does it stay constant. Nascent projects change so rapidly that any attempt to produce good documentation usually leads to those same documents being outdated before they are published. Luckily, maturity usually means a certain level of stability where documentation can be produced and consumed before a new version of the system is released and the documentation has to be updated. It becomes an infinite, but necessary loop.

At some point someone may write a book on the subject at which point in time the current state of system is not only captured, but actually printed and bound, effectively freezing the state of the system for all time. But if software is constantly evolving, doesn’t the material physically printed in these books become obsolete? Yes, and it’s a common problem that those of us who purchase technology books have come to accept. A technology book isn’t like most other books — it has a built in but hidden expiration date. Because almost all software invariably changes, the printed page being a physical immutable object can no longer accurately describe the current state of the system. Most readers of technology books learn this, and book publishers have grown smarter about it and started to identify the version of the software that the book applies to.

The Problem

At some point the printed material itself becomes more than outdated, it becomes obsolete. I have collected hundreds of technology books over the years. Some for work endeavors, others for personal learning, but all have served me well. Unlike non-technology focused books, I have to periodically purge my collection to avoid the issues described earlier. There may be someone who becomes interested in the lineage of a particular piece of software and therefore the book becomes a historical reference capturing the evolution of a piece of software. But for most of us, they simple become unusable and start collecting dust.

With book prices typically ranging between $30.00 and $70.00, purchasing something that’s going to be out of date in the near future may not be the best financial decision in the long run. Witness the prices for a used Java EJB book on Amazon.

amazon_ejb_ss

This particular title, is selling for $0.29 used. Anyone who purchased this book new and at list price has lost 99.99% of it’s original value. It’s understandable why. This particular book has been in print since late 2004. The subject matter is mature but now outdated. The value that this book provides is limited to anyone who must still use or support this older version and the audience will continue to shrink over time.  To be fair to the authors of the book, an updated version of this book has already been released that addresses the improvements to EJBs. The changes are sufficiently large enough to warrant re-purchasing the book again even if someone currently possesses the previous version.

After years of this, I think it’s getting wasteful. Both on my wallet and the amount of dead trees that I currently house in my personal library. For my technical collection, I have wished for a solution that avoids the dead tree and continual update syndrome for those of us who purchase technology books are subject to. I want authors to get paid, high quality material to continually be published, and I’m willing to re-purchase for documentation that contains significant changes or for new version. However, I also want to have access to updates and fixes to typographical and code examples. Printed material just can’t offer that and my books are usually marked up with errata found on the publishers or book’s web site. It’s not an optimal solution by any stretch of the imagination.

An Interim Solution

One interim solution that I have used for the last couple of years is Safari Books Online. Safari has multiple membership levels, and I subscribe to the one that gives unlimited access to the library for approximately $40.00 a month. So for about the price of one physical book, you get access to a dizzying array of technical books for the same cost. For me personally it’s worked well. Here’s an example of the book discussed earlier.

safari_ejb_ss

Safari allows me access to all versions of this book. As new editions are released, the updates are also released into the library satisfying my need for access to timely updates to typographical and code corrections. The interface gives a true print fidelity view as well so what appears on the screen is what the book actually looks like printed. Just as important, you can annotate, bookmark, and make notes. Additionally, as a bonus, you are also given tokens that can be redeemed to download chapters and/or entire books into PDF form and kept offline. Safari has a ton of features so it’s worth a look for someone who is purchasing books on a regular basis.

The problem with Safari is that it is a service. Once you stop paying, you lose everything. PDF’s you generate and have downloaded are yours, but everything else is gone. So far it hasn’t been an issue, but it’s something to be aware of. Finally, and this is a personal issue, I don’t really enjoy reading on a monitor. Usually with most technical books it’s done in a reference type mode so it’s usually not a continual three hour session but nevertheless it’s not very ergonomic.

Overall Safari is great. It deals with most of my issues about owning technical books. I still have to read them online, but for the price, my technical collection expanded a hundred-fold and I never have to donate a book again. As an interim solution I think it has worked well and I’ll continue to subscribe to Safari just for the unfettered access to a huge technical library. Still, what I really want is something that I can hold in my hand but has the power of Safari.

The Perfect Solution

What I really would like is for the publishers of technical books to always provide a version of the book that could be used with the latest eReaders like the Barnes & Noble Nook or the Amazon Kindle. If I could tote around one of those with a couple hundred technical eBooks, I’d be loving life. I wouldn’t know what to do with myself if I could get access to Safari using the eReader as an interface. The eBook concept, especially for technical books, is a great idea that is being offered more and more. They’re priced considerably less that the printed version, and I don’t have to deal with the disposal issues later.

I think we’re close enough that I purchased a Nook. The screen may be smallish for technical reading, but it’s a start and it has to be better than the monitor. It can hold an entire libraries worth of book and it’s portable. Only time will tell, but it’s a start. As a result, I think I’ll convert this article into a series about getting technical material on eReaders. As I progress I’ll continue the series. Happy eReading for all.

30. November 2009 by Jason
Categories: Personal | 1 comment

Fix zimbra logrotate issues

If this error occurs on a host with Zimbra installed:

/etc/cron.daily/logrotate:
error: zimbra:64 unexpected text

It’s due to a typographical error in /etc/logrotate.d/zimbra that has not been fixed in the latest release (6.0.3.) The log rotate configuration file for Zimbra as delivered has a typographical error in the freshclam section.

1
2
3
4
5
6
7
8
9
10
11
12
/opt/zimbra/log/freshclam.log {
    daily
    missingok
    copytruncate
    notifempty    create 0660 zimbra zimbra
    postrotate
     kill -HUP `cat /opt/zimbra/log/freshclam.pid 2> /dev/null` 2> /dev/null || true
    endscript
    compress
    size 5000k
    rotate 7
}

On line five, the notifempty and create 0660 zimbra zimbra have been concatenated together. To fix, just move the create stanza to the next line like so.

1
2
3
4
5
6
7
8
9
10
11
12
13
/opt/zimbra/log/freshclam.log {
    daily
    missingok
    copytruncate
    notifempty    
    create 0660 zimbra zimbra
    postrotate
     kill -HUP `cat /opt/zimbra/log/freshclam.pid 2> /dev/null` 2> /dev/null || true
    endscript
    compress
    size 5000k
    rotate 7
}

Be aware that since this isn’t officially fixed from the folks at Zimbra, any updates applied after this change is made may revert this back to the original, broken behavior.

Enjoy.

24. November 2009 by Jason
Categories: Linux, UNIX | Tags: | Leave a comment

Fedora 12 on VirtualBox

Just a quick note that if you use the default VirtualBox settings during the “Create New Virtual Machine” wizard for a new install of Fedora 12, you’ll find that the .iso will boot to the live user screen, but when attempting to run the “Install to Hard Drive” installation routine, it’s runs for a second and then quits.

The problem is that the default memory settings in VirtualBox for fedora are insufficient. Reset the system base memory to a more appropriate 512MB and you’ll find the installation routine runs as expected.

Enjoy.

20. November 2009 by Jason
Categories: Virtualization | Tags: , | 7 comments

← Older posts

Newer posts →