25

I want to install firefox on a Ubuntu server that currently has no graphical desktop environment. Is it possible to install some minimal display management tools that will allow me to launch graphical firefox (or any other graphical browser capable of displaying websites in not text-only mode)?

Unfortunatelly, lynx, links and similar text-only browsers are not good enough.

1
  • 3
    Graphical environment and "desktop" are two different things. Instead of a desktop (like KDE or Gnome, with icons &c - basically a wannabe Windoze), you can install a window manager, which will allow you to run basically any graphical application. I am writing this in Firefox on OpenSuSE, running the FVWM2 window manager.
    – jamesqf
    Jun 13, 2019 at 5:14

5 Answers 5

48

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.

3
  • 30
    To elaborate more: If you are connecting to the station remotely via SSH, you can also just tunnel the X protocol through. Then you do not need to install the Xserver on the remote machine (just install the xauth component) because the X session is tunneled to Xserver on your station. So you can actually run the firefox on the remote machine, but the window is displayed on your local machine. See for example this discussion unix.stackexchange.com/q/12755/37669 .
    – Fiisch
    Jun 12, 2019 at 17:24
  • 10
    Firefox doesn't require xorg, because you can run firefox in headless (no GUI) mode.
    – OrangeDog
    Jun 13, 2019 at 11:01
  • 6
    It depends on an X server. By the nature of the X protocol, that server just doesn't have to be running on the local host, so it's not an installation requirement.
    – chepner
    Jun 13, 2019 at 15:04
3

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.

3
  • This looks like a fun experiment. But I have to add that I've encountered some issues when trying to use it. First of all, the website you linked provides an old version of browsh, I found the latest here: github.com/browsh-org/browsh Second of all, it does not seem to work with the latest firefox version - I had to download from Firefox ftp server: ftp.mozilla.org/pub/firefox/releases It is a fun little experiment that will definitely not replace normal full scaled browser and is too complex for text-browser tasks, but as I said, it looks fun to play around with.
    – deimos
    Jun 13, 2019 at 16:03
  • Ah, and it also crashes when I try to open askubuntu.com. Crashes and completely messes up my terminal, printing every change of mouse pointer location :D Reddit opens fine, tho.
    – deimos
    Jun 13, 2019 at 16:09
  • 1
    @deimos you can bring back your terminal to a sane state with the reset command.
    – Ruslan
    Jun 14, 2019 at 10:39
2

Firefox (or any other desktop application for that matter) doesn't have a dependency to graphical desktop environment, because there's no need to have it installed locally. You can install Firefox on your server and connect to it from a GUI machine using ssh -y, and when you start Firefox from that SSH session, you will get Firefox running on your Ubuntu server, while its window will be displayed on the GUI machine.

Additionally, there are browsers which can render graphics directly, not relying on X/Wayland. For example, OWB and Netsurf have SDL frontends.

0

Another interesting alternative might be to install Firefox inside a docker container that has a graphical environment and NoVNC.

jlesage/firefox has a pretty solid image for this.

Granted, it means having docker installed as a prerequisite, but if you plan to host containerized applications on the server anyway, doesn't take much to set up.

0

If you just need it to run (but not necessarily interact with it), search for "headless mode": https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/

Edit: Will, exact instructions depend on OS. Generally, run Firefox from the command line with the -headless parameter. If you have more than one profile, don't forget the -P parameter.

Example: firefox -headless -P default "https://askubuntu.com/"

1
  • Could you put the steps in instead of just the link? Thank you.
    – Will
    Dec 5, 2022 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .