I haven't been able to find anything definite about how those canteloupes got contaminated with listeria, just the possibility that it was from farm animals.
Nobody would have gotten sick if they had washed the outside of the melon with hot soapy water first before cutting in to it.
Most often these disease outbreaks are on plants/fruits that sit on the soil, lie the melons, or like lettuce and spinach. Most often they come from contamination with manure, sometimes because the lettuce is directly sprayed with a manure slurry, for fertilization.
If you are growing your own food and don't have animals in the garden and don't use fresh manure, you should never have a problem. If you get your food from a local farm, where you know what the farming practices are, you should never have a problem. Any produce you get from a grocery store should be washed well.