It’s rather hard to guess without seeing the output of the build.
You might try using tmux
(or similar) to keep the session open when you get disconnected (you can reconnect to the session with tmux attach
).
Maybe have a look at PostgreSQL 13 update?