Try this bash script.
#!/bin/bash
apt update -y
apt install -y build-essential libssl-dev zlib1g-dev libpam0g-dev libselinux1-dev libedit-dev libkrb5-dev libaudit-dev vim-tiny curl
curl -sS https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz | tar xfz -
cd openssh-9.8p1
./configure --prefix=/usr/local/openssh --with-tcp-wrappers --with-pam --with-libedit --with-kerberos5=/usr --with-ssl-engine --with-selinux --with-audit=linux --w
ith-systemd --disable-strip --with-mantype=doc --with-4in6 --with-privsep-path=/run/sshd --with-pid-dir=/run
Tested on Ubuntu 18.04, 22.04
Result:
That is all