How to build headless paraview in local?

Offscreen and headless are not the same thing.

You have a graphical environnement (Xorg) but do not want the window to show → offscreen
You do not have a graphical env or even no GPU at all → headless

To render offscreen, use the standard paraview release but instead of pvpython, run with pvbatch.
To render headless, use the EGL (need a GPU) and OSMESA (no GPU needed) release.