how can I compile Ortep3 on Ubuntu?

What I can see from Repology - the 1.0.3 version is the latest available.
Gentoo has ebuild for this application at version 1.0.3-r1.

To get it compiled on Ubuntu 18.04 LTS we need to install necessary build tools:

sudo apt-get install pgplot5 libx11-dev gfortran

and then download ortep.f from some Gentoo distfiles mirror:

wget http://ftp.corbina.net/pub/Linux/gentoo/distfiles/81/ortep.f

(^ this version have pgplot disabled, so if you have normally working one from 2000s - use ortep.f from https://github.com/ornl-ndav/ortep)

and compile it

gfortran -O2 -o ortep3 ortep.f -lpgplot -lX11

It will work:

$ ./ortep3
ORTEP-III Version 1.0.3 Jan. 25, 2000
Enter instruction set file name or "exit" [TEP.IN]:  
...

Other possible alternative is to use pre-compiled binaries from https://ornl-ndav.github.io/ortep/compiled.html .