I decided to setup a Linux development environment so I could separate my .NET development work from Java development work. Here are the steps I took (with some trial and error along the way) to get this setup properly.
1. Install VirtualBox
This is easy. Easier than Docker, easier than VMWare, easier than Hyper-V. It requires virtually no setup. Just run the installer and follow the on-screen instructions. Very light-weight VM environment.
2. Setup VM with Ubuntu
- Suggest at least 4GB RAM
- Suggest at least 30GB HDD
After starting the VM, it will ask you to boot to a media/image. Select an appropriate ISO downloaded from here: https://www.ubuntu.com/download/desktop. I, personally, used Ubuntu 17 (which is not the LTS). It seems to be working well for me, though.
3. Install VirtualBox Guest Additions
The Guest OS will benefit greatly by installing the VirtualBox Guest Additions. These are essentially drivers that allow the Guest/VM OS to interact with the HOST OS more efficiently. It is required to enable multiple monitors and copy/paste between Host and Guest (as described in the next section).
sudo apt-get install virtualbox-guest-additions-iso /media/sean/VBox.../VBoxLinuxGuestAdditions.iso
Shut down the VM.
4. Enable multiple monitors, copy/paste and drag/drop
- Go to VM > Settings
- Under General > Advanced, select “Shared Clipboard”: Bidirectional
- Under General > Advanced, select “Drag’n’Drop”: Bidirectional
- Under Display > Screen
- Specify 2 monitors (or more) for “Monitor Count”
- Give “Video Memory” at least 64MB RAM
- Start VM
5. Install Google Chrome (if you want)
I like Chrome. Many prefer Firefox. It is personal preference.
However, one thing I think Chrome does better than any other browser, is synchronize bookmarks, addins, and credentials. Just login to google and your browser (including history) looks the same as all the other machines.
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list sudo apt-get update sudo apt-get -y install google-chrome-stable
6. Install Java 1.8 JRE and JDK
Important for Java development, obviously. I found that OpenJDK does not include JavaFX, though. So, I had to include that in the install, as well.
sudo apt-get install openjdk-8-jdk openjdk-8-jre openjfx
7. Make it easy to create desktop shortcuts, install gnome-panel
Sure, you could be super cool and always run it from the command-line, but why waste the time. Just create a desktop icon. gnome-panel has a tool that can make it easy to create desktop icons. Run the tool after installing it (below) with the command “gnome-desktop-item-edit –create-new ~/Desktop”. The first parameter indicates you are creating a new desktop icon, the second parameter indicates where (the “Desktop”, in this case).
sudo apt-get install --no-install-recommends gnome-panel
8. Install Eclipse
- Download the appropriate .tar.gz from Eclipse Downloads website
- Extract the contents to /opt/eclipse
cd /opt; tar -xvzf ~/Downloads/eclipse…tar.gz
- Create a desktop application entry for eclipse
gnome-desktop-item-edit –create-new ~/Desktop
9. Configure Eclipse to use GTK version 2 and more memory
Eclipse (in my experience) has a number of issues running against GTK version 3. Telling Eclipse to explicitly to use GTK version 2 will likely save you headaches from “No more handles” errors when drag-and-dropping windows and panels. To configure eclipse to use version 2 of GTK, modify the eclipse.ini file in /opt/eclipse/eclipse.ini. In my example eclipse.ini file, I have told it to:
- Run the Java VM with a
- minimum of 512MB ram
- maximum of 2GB ram
- perm-gen size of 1GB ram
- Run the Eclipse UI using GTK Version 2
-startup plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.401.v20161122-1740 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.defaultAction openFile --launcher.GTK_version 2 --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.8 -XX:+UseG1GC -XX:+UseStringDeduplication -Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx2048m -XX:MaxPermSize=1024>
Note, that when making these changes, it appears the Eclipse takes a little longer to start (by at least 10 seconds), but performs much better once loaded.