Reputation: 63
Is there a way to run Emacs GUI on Ubuntu Server (default install with no X Window System installed)? I installed emacs using
apt-get install emacs
but when I open a file with
emacs <filename>
I only get the text based version
Upvotes: 2
Views: 2289
Reputation: 73390
You need Emacs to be built with X support, but you don't need the host that Emacs is running on to have an X server installed; you only need that on the host providing the X display.
As you've installed Emacs via apt-get
(and so long as it wasn't the -nox
(no X) package that you installed), these dependencies should have been taken care of already.
Assuming you're using ssh
to connect to the server running Emacs, the traditional (and simplest) approach is to enable X forwarding by using ssh -X
or ssh -Y
. Read the ssh
man page on these, as there are security considerations.
With X forwarding enabled for your ssh connection, you can just run emacs
from the remote shell, and your local X display will be used.
Note that if your network connection to the remote host is poor, then performance will be awful. Running the remote emacs in a terminal is orders of magnitude more efficient.
Enabling compression of the ssh connection is probably worth doing if performance is less than ideal.
If X forwarding has been disabled or is otherwise not acceptable, there are alternatives. The last time I looked, xpra looked like an avenue worth pursuing, but I've not used it yet.1
There is also https://en.wikipedia.org/wiki/NX_technology with various implementations such as FreeNX, OpenNX, NeatX, X2Go. Again, I've not used any of these, so I'm unable to comment.
Finally be aware that you can always run a local GUI Emacs and access the remote files via Tramp. For extended use cases I invariably install Emacs directly, but for occasion editing needs Tramp is superb, and it seems to me that many people happily use it by preference, so YMMV. (If your network connection is unreliable then a local Emacs using Tramp will likely save you some frustration.)
1 I actually tried, but there were xpra version incompatibilities between the client and server in question. This kind of issue might also exist for the other alternatives, whereas the X forwarding protocols are so long established that I would think it unlikely that such incompatibilities would occur nowadays. Again, YMMV.
Upvotes: 2
Reputation: 16214
Try installing emacs from ppa:
sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-get install emacs-snapshot emacs-snapshot-el
then run it with the file parameter you want:
emacs-snapshot your_file
Upvotes: 0