Go to http://www.factorio.com/download-headless/stable and download the latest stable. As of this writing, that would be 0.12.26
The headless server is a tarball of a (mostly?) statically-compiled server along with data. You will need to extract it and put it into a directory. Since this is a 3rd-party program, not managed by the package manager, I feel like
/opt is a good choice.
tar xf factorio_headless_x64_0.12.26.tar.gz sudo mv factorio /opt sudo chown -R root:root /opt/factorio