S-band RF-guns are highly developed for production of low emittance relativistic electron bunches, but need powerful klystrons for driving. Here, we present the design and first experimental tests of a compact S-band gun, which can accelerate electrons up to 180 keV powered by only 10 kW from a compact rack-mountable solid-state amplifier. A pin-cathode is used to enhance the RF electric field on the cathode up to 100 MV/m as in large-scale S-band guns. An electron bunch is generated through photoemission from a flat copper surface on the pin ex-cited by a UV laser pulse followed by a focussing solenoid producing a low emittance bunch with 0.1 mm mrad transverse emittance for up to 100 fC bunch charge. We are currently in the conditioning phase of the gun and first experiments show good agreement with simulations. The compact gun will serve three purposes: (i) it can be used directly for ultrafast electron diffraction; (ii) as an injector into a THz booster producing 0.3 MeV to 2 MeV electron bunches for ultrafast electron diffraction; (iii) The system in (ii) serves as an injector into a THz linear accelerator producing a 20 MeV beam for the AXSIS X-ray source project.