It is imperative to keep light from reaching the nutrients in the bucket. For this reason, it is recommended to use black buckets for DWC. When using white buckets,they can be wrapped with several layers of duct tape or a layer of anti-corrosion pipe tape. Be sure to tape the lids also.
Algae needs light to grow. Ensuring no light makes its way to the nutrients through the bucket is the best way to prevent algae growth. Algae also thrives in anaerobic conditions (lack of oxygen) so be sure that plenty of air is being pumped into the buckets. I dont know the minimum amount, but you should not have any problems if you are pumping in at least 500 cc's/min of air per gallon. 600 cc's/min per gallon will ensure plenty of oxygen is being introduced in the nutrients.