This paper solves the output synchronization problem for groups of identical linear agents subject to constant external disturbances. We propose novel distributed control laws with integral action. In a first step, we assume that each agent has access to its own state. Then, we present observer-based implementations for the cases where each agent has only access to its output or to a relative output measurement with respect to its neighbors in the graph. We show that this method can also be used in order to solve a cooperative distributed tracking problem, where each agent has a local reference signal and the group objective is to synchronize to the sum or average of all their references. Numerical examples illustrate the results.