I have a new machine with Ubuntu Server. On that server I would like to have Apache with some web services.

But how do I install Eclipse on Ubuntu Server? Right now I have no GUI, just command line.

  • Install a GUI first, then? Why are you running desktop software on a server version of Ubuntu in the first place if you want to use it as a development environment? – BoltClock Feb 14 '12 at 19:24
  • i wanted to try a 100% same environment. but i might rethink it. – Gero Feb 14 '12 at 19:58

First of all: If it's a production server. Don't do it. Installing a GUI will slow performance and may open more security holes. Also never develop directly on a production server.

Secondarily: If anyone sees this prior to installing Ubuntu Server, you should probably install the desktop version of Ubuntu instead and then install the server-services, since that's quite a lot more well documented and you're probably not going to run Eclipse on a dedicated (production-)server anyway.

And now the answer:

First install the ubuntu-desktop package with # apt-get install ubuntu-desktop (do this as root, or by prepending sudo to the command), then reboot your computer and install eclipse as you would on any other Ubuntu computer.

See section one on http://www.ubuntugeek.com/install-gui-in-ubuntu-server.html for more detailed instructions


I needed to do this recently to run Eclipse plugin tests on Travis CI (which, as of this writing, runs Ubuntu 12.04 LTS Server Edition 64 bit).

Installing Eclipse can be as simple as downloading and extracting the Linux version of Eclipse (For Travis CI, be sure to download the 64 bit edition). However, Eclipse will crash on starting, giving a "Cannot open display" or similar error. This is because the server edition of Ubuntu is not configured to use a monitor, and (I believe) much of the software needed to show graphics is not included. The solution by sakjur resolves this by installing that software.

A less heavy-weight way to do this than installing ubuntu-desktop is to simply add a fake display, in the form of Xvfb. Once installed, you start it in a background process, set the DISPLAY environment variable and then begin Eclipse. In the below example, I install a plugin needed to run the JUnit Test Plugins.

sudo apt-get install xvfb
Xvfb :1 &        #The capitalization of this is important  
export DISPLAY=:1
/dir/to/eclipse -nosplash -application org.eclipse.equinox.p2.director  -repository http://download.eclipse.org/eclipse/updates/4.4/ -installIU org.eclipse.pde.junit.runtime

For Travis CI, this gets even better, because Xvfb is already installed! From the docs, simply run:

export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start

prior to executing your Eclipse commands. Example Travis CI build

  • 1
    Even better than manually starting Xvfb and exporting DISPLAY you can use: xvfb-run -a eclipse ... and it will automatically start X and set the right DISPLAY, tearing it down when you close eclipse – Adam Collard Mar 6 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.