Is it possible to install Firefox on Ubuntu with no desktop enviroment?
You can install any package available in the repositories using APT. APT is responsible for satisfying dependencies.
Counter-intuitively, the Firefox package does not depend on the X server (or Wayland) which is needed to display it. When I tried to run Firefox without X server running, I got:
$ firefox
Error: no DISPLAY environment variable specified
So to install required packages to display Firefox, issue:
sudo apt install firefox xorg
Then you can run:
startx
firefox
to get a very basic Firefox window (even without the ability to resize or close it etc. by the usual means).
You can exit Firefox by pressing Ctrl+Q. Then run exit
to quit X server.
You may want to try Browsh (https://www.tecmint.com/browsh-text-web-browser-for-linux):
Browsh is an open source, simple and modern text-based browser that renders in TTY terminal environments. It is made up of a minimal Golang CLI front-end and a browser web-extension (headless Firefox) which actually offers most of the functionality to create a purely text-based version of web pages and web apps.