repmgr 4.x is implemented as a PostgreSQL extension; normally the upgrade consists of the two following steps:
Install the updated package (or compile the updated source)
repmgrd (if running) must be restarted.
For major releases, e.g. from 4.0.x to 4.1, execute ALTER EXTENSION repmgr UPDATE on the primary node in the database where the repmgr extension is installed.
This will update the extension metadata and, if necessary, apply changes to the repmgr extension objects.
Always check the release notes for every release as they may contain upgrade instructions particular to individual versions.
Note that it may be necessary to restart the PostgreSQL server if the upgrade contains changes to the shared object file used by repmgrd; check the release notes for details.