  Context. Friends-of-friends algorithms are a common tool to detect galaxy
groups and clusters in large survey data. In order to be as precise as
possible, they have to be carefully calibrated using mock catalogues.
  Aims. We create an accurate and robust description of the matter distribution
in the local Universe using the most up-to-date available data. This will
provide the input for a specific cosmological test planned as follow-up to this
work, and will be useful for general extragalactic and cosmological research.
  Methods. We created a set of galaxy group catalogues based on the 2MRS and
SDSS DR12 galaxy samples using a friends-of-friends based group finder
algorithm. The algorithm was carefully calibrated and optimised on a new set of
wide-angle mock catalogues from the Millennium simulation, in order to provide
accurate total mass estimates of the galaxy groups taking into account the
relevant observational biases in 2MRS and SDSS.
  Results. We provide four different catalogues (i) a 2MRS based group
catalogue; (ii) an SDSS DR12 based group catalogue reaching out to a redshift z
= 0.11 with stellar mass estimates for 70% of the galaxies; (iii) a catalogue
providing additional fundamental plane distances for all groups of the SDSS
catalogue that host elliptical galaxies; (iv) a catalogue of the mass
distribution in the local Universe based on a combination of our 2MRS and SDSS
catalogues.
  Conclusions. While motivated by a specific cosmological test, three of the
four catalogues that we produced are well suited to act as reference databases
for a variety of extragalactic and cosmological science cases. Our catalogue of
fundamental plane distances for SDSS groups provides further added value to
this paper.
