We describe the growth of high quality AlN and GaN on Si(111) by gas source molecular beam epitaxy (GSMBE) with ammonia (NH3). The initial nucleation (at 1130-1190K) of an AlN monolayer with full substrate coverage resulted in a very rapid transition to two-dimensional (2D) growth mode of AlN. The rapid transition to the 2D growth mode of AlN is essential for the subsequent growth of high quality GaN, and complete elimination of cracking in thick ( > 2 μm) GaN layers. We show, using Raman scattering (RS) and photoluminescence (PL) measurements, that the tensile stress in the GaN is due to thermal expansion mismatch, is below the ultimate strength of breaking of GaN, and produces a sizable shift in the bandgap. We show that the GSMBE AlN and GaN layers grown on Si can be used as a substrate for subsequent deposition of thick AlN and GaN layers by hydride vapor phase epitaxy (HVPE).