Hydroponics
Hydroponics is the practice of growing plants in nutrient-enriched water rather than soil.
Hydroponics is incredibly productive and requires little space. For example, Factor e Farm's experiments found that they could grow $1 of lettuce per square foot per week. And the Institutre of Simplified Hydroponics has found that they can grow 2kg of vegetables a day on 20m2 of space [1]. Indoor growing in a greenhouse greatly reduces losses to pests.
See here for free instructions on building several different hydroponic systems. See Wikipedia on hydroponics for more information.
Open source software for automating hydroponic systems.
Aquaponics is a kind of hydroponics that uses the water from fish tanks. This eliminates the need for an input of nutrients.