Design of a 5 MeV electron linac based X-ray source