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.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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