Real Goods Solar said Wednesday it has signed an agreement to buy Alteris Renewables, a deal that will merge two solar installers from two opposite corners of the country.