This applies to OpenSSH installation on both Debian and Ubuntu.
Please note that while you could do issue the commands below over SSH maintaining the session, it is recommended to do this using the console. You could get yourself isolated from SSH if the connection gets dropped.
First, remove the existing host keys:
Then we reconfigure OpenSSH, which will trigger the keys to be regenerated: