I recently wrote a list of things to keep a tank clean looking. Here it is:
1. Do not place the tank where direct sunlight will shine on it.
2. Do not over-feed your fish. They will be fine with 1-2 feeds per day. The food should be all gone in 2-3 minutes.
3. Do not put too many fish in your tank. The rule of thumb for small freshwater fish is 1 inch of fish per gallon of water.
4. Do not leave your tank light on too much. For best results, get a timer for $5, and set the light to come on for 4-5 hours in morning, off for at least a couple hours, and 4-5 hours on in the evening. Algae needs light for a few hours to start photosynthesis, while other plants in your tank start using light right away. This lighting schedule takes advantage of that.
5. Maintain your tank. I recommend taking out 15-20% of the water weekly, and adding new water. Vacuum your gravel while taking water out. Treat the new water so it does not contain chlorine.
6. Try adding live plants to your tank. They will compete with algae for nutrients, reducing the algae in the tank.
7. Get one of those magnetic cleaners to easily clean any algae from the walls of your tank. This should only have to be done 1-2 times per month, at most, in a healthy tank. Some fish eat algae on surfaces, which could eliminate this task altogether. These fish do not help with green water though, and may actually make that condition worse since they create a lot of waste for the algae to consume.
8. If all above steps don’t clear your water within a couple weeks, you may consider buying a UV filter. This will kill all free floating bacteria and algae.