Download tarball from emacs website.
Install its dependencies:
sudo apt install build-dep emacs
Configure it and make install it:
make install
./configure --prefix=$HOME/opt/emacs --with-native-compilation=aot --with-x-toolkit=gtk3 --with-json