Ubuntu Development Tools

2019/06/01

Ubuntu Development Tools

An earlier post about some niggles with Ubuntu packages reminded me of just how smooth things are in general. The minor bumps are much more visible as a consequence, but really I have it pretty damn good.

Let me tell you young whippersnappers (and get off my lawn!) that I started with the boot’n’root disks in the 0.96.* days and my first packaged Linux was SLS. So I know how green the grass is these days.

Anyway, I just configured a brand new laptop for work and I thought I’d share a few of the tools and applications that I explicitly install after the basic desktop is up and running.

Installable with APT

One of the joys of working under Ubuntu is that the Advanced Package Manager (APT) takes care of many of the tools I want to install, so the following incantation gets everything in order nice and quickly:

sudo apt install terminator htop openjdk-11-jdk chromium-browser git curl \
                 gnome-tweaks docker docker-compose pluma python3-pip links \
                 tree net-tools pandoc mysql-client postgresql-client \
                 whois jq inkscape

I also remove the default vim-tiny editor and install the full version of vim instead:

sudo apt remove vim-tiny
sudo apt install vim

Taking a look at this set of apt installable tools in more detail:

terminator

My favourite terminal emulator - provides some of the basic features of tools like tmux and screen. All I normally use it for is the ability to split the terminal into multiple sub-terminals with various Ctrl-key combinations. For example, Ctrl-O splits off another terminal hOrizontally, so a common work flow for me will be to run an app and then split the screen so I can carry on editing configuration files while keeping an eye on the logging output.

Editing a hugo article within Terminator

The screenshot example shows me editing a markdown page for this blog while hugo (a static site generator) runs in server mode and the generated page is viewed in a browser in the background.

htop

More in the eye-candy than the genuinely useful category, this displays a very fetching, colourful, and configurable set of system statistics along with a process listing. I probably use the ps command more than this, but it’s occasionally useful.

Running htop on my laptop

The screenshot example shows me running htop on my laptop. Admittedly I usually only fire this up when I’m trying to work out why my laptop has crawled to a halt, and currently it’s running just dandy so there’s nothing very exciting in the process list here.

openjdk-11-jdk

I’m a back-end Java developer, so the Open JDK is my daily driver for software development. Currently we’re on version 11 of the language (and hence the JDK) and we’re getting used to the faster fixed release cycle. From my perspective in the developer trenches this is working well. Java 11 didn’t really offer anything in the way of new syntax features over Java 10, but it’s the “long term support” version of the tooling so I’ll be seeing a lot of it even once I’ve moved my personal development environment onto Java 12.

The Oracle versions of the JDK now come with some sneaky licensing requirements, so I heartily recommend that you choose Open JDK over Oracle JDK unless you have made a conscious business decision to adopt the licenses of the latter. Note that there are no longer fundamental differences between the two codebases.

If you want to be sure you have the cutting edge version of the JDK installed or if you want to have access to older versions of the JDK you may still want to install them manually and use update-java-alternatives to switch between them.

When using Open JDK installed from the Ubuntu repositories do watch out for those “niggles” I mentioned in the opening paragraph. In particular there was this unnerving decision on the Open JDK 11 package.

chromium-browser

I’m most at home in Firefox, but Chromium is slightly better supported these days. From time to time a website will refuse to work with Firefox, or I’ll want to check that some peculiarity that I’m experiencing on a site under development isn’t specific to Firefox. On the whole I’m just happy to have choices though.

Now that browser applications get so much more attention than desktop applications I rarely feel like a second-class citizen in the Ubuntu world. In particular the use of Microsoft Word is no longer a deal-breaking mandatory requirement in my work. I haven’t used a Windows machine at home or at work for several years now!

git

The distributed source control system par-excellance. Famously user unfriendly in its choice of syntax for the command line tools, it’s nonetheless fantastic once one gets used to them (with a typical amount of Googling when needing to do something out of the ordinary). I remember the days of coding without any source control far too well and the days of fighting for locks on files or corrupted repos on some early systems are not things that I miss.

curl

Another essential tool - especially vital for those of us who write backend services exposed as Http endpoints. I’m always happy when documentation provides a curl example as I know that it doesn’t code in some weird browser dependency or omit essential headers.

gnome-tweaks

I find some of the Gnome developers’ decisions about what should and shouldn’t be configurable decidedly oppressive, but for the most part I can live with them. For some things the Gnome Tweaks tools allows you a little more lattitude. I usually have the trackpad behaviour changed slightly and not much else.

I do wish they’d get rid of the pointless “shield” screen though - nice though it is to see a picture of my cat before I dismiss it a fraction of a second later to get to the login prompt. Alas that one’s not configurable :‘(

Running gnome-tweaks to change some otherwise inaccessible settings

In this example you can see the option for changing right-click options on the trackpad. On some versions of Ubuntu this is the only way to turn on the lower-right area of the track pad to get right-click (context menu) behaviour.

docker and docker-compose

Docker and Docker Compose make my life as a developer so much simpler. I love being able to fire up a dependency of my project with a quick docker command instead of having to figure out all of the configuration details. Being able to fire up different versions of a database with Docker for debugging different applications is fab, and being able to fire up an entire suite of dependencies with Docker Compose is even better.

One team I was working with recently had a docker compose environment to fire up something like ten different applications in a single command and dismiss them as easily. The suite included a mock S3 server, Grafana, Cassandra, MySQL, and Kafka. Even with configuration documentation it would have taken a while to get all of those running together happily on the same machine!

pluma

Again, I don’t like some of the simplifications that Gnome has made to its applications. Pluma is basically Gedit without those simplifications and I’m very happy with it.

python3-pip

This is more what you might call an aspirational install! I plan to become proficient in Python over the next year or two. In my recent interviews with Diabol AB I realised that I have a pretty limited set of skills when it comes to scripting languages and I think it would be useful to have something under my belt that’s easier to work with than Linux shell scripts.

Anyway, pip is the package installer for Python and the python3-pip package (which installs the pip3 command line tool) is the version specific to Python 3. Python 3 itself is available out-of-the-box on Ubuntu 18.10 so this is all I need at the moment!

Links is a text mode browser. I don’t use it that often, but it’s nice for reading badly formatted websites where reader mode isn’t available and occasionally will side-step paywalls. It’s also a good indicator that a website is somewhat friendly to those using screen-readers so checking ones own site with this is a good (but insufficient) first step towards being accessibility aware. I generally aim for Paperstack to be readable with links.

tree

Tree renders a recursive tree hierarchy of the current working directory and its contents in the console. Mostly I use it to get a quick idea of how things are laid out in a code project before I start browsing it.

Running tree against a hugo content directory

In this example you can see the output of tree when run in the content directory of my blog (i.e. this site!)

net-tools

This is a package rather than a single tool. It makes a number of network-related tools available. The ones I use most often are ifconfig and route. ifconfig provides a quick overview of networking interfaces and their configurations. route provides a brief overview of the routing table.

I’ll often use both when working out whether my VPN connection is configured correctly.

pandoc

Pandoc is an amazing tool for converting between document file formats. For example the following command converts an article written in Markdown into a Microsoft Document file format with sensible defaults to the resulting output:

pandoc -i article.md -o article.docx

See https://pandoc.org/ for details (or try your own toy example in Markdown)

mysql-client and postgresql-client

Now I have Docker I don’t often install the databases directly, but I very frequently need to connect to pre-existing databases and dockerised instances in order to diagnose problems or create data for smoke tests.

It’s convenient to have the clients for MySQL and Postgres installed and ready to go when I need them. At one point it was a pain to get the client without the rest of the database server, but the packages are nicely broken out these days.

whois

When I ponder purchasing a domain for some new hair brained idea the first thing I do is see if it’s already registered in the whois database. This tool does that. I usually supply the “human readable” flag to strip off some of the boilerplate. For example:

whois -H paperstack.com

jq

The command line JSON processor lets you process and reformat JSON data at the command line. The simplest use is to pretty-print incoming JSON. For example:

(cat <<-JSON
   { "k1" : "value1", "k2" : { "k3" : "value3", "k4" : [ "v4.1", "v4.2", "v4.3" ] } }
JSON
) | jq .

That outputs the JSON pretty printed:

{
  "k1": "value1",
  "k2": {
    "k3": "value3",
    "k4": [
      "v4.1",
      "v4.2",
      "v4.3"
    ]
  }
}

An example of changing the format entirely:

(cat <<-JSON
   { "k1" : "value1", "k2" : { "k3" : "value3", "k4" : [ "v4.1", "v4.2", "v4.3" ], "k5" : "value5" } }
JSON
) | jq ".k2 | { A: .k3, B: .k5 }" 

That outputs JSON containing just a few values from the original:

{
  "A": "value3",
  "B": "value5"
}

When the output is sent to a console tty the pretty printed output is also syntax-highlighted in colour. The man page is well written and has lots of examples. If your question is “How do I reformat this JSON so that…” then the answer is likely to use jq.

Also, and unrelated to the tools, I love the ‘here document’ notation in bash.

Inkscape

Inkscape is a vector graphics drawing application. It’s great for creating line art, for doing simple graphic design tasks, and for creating SVG files for buttons and other assets in your own applications. A typical use for me is laying out the design of a bar price menu for our dance events. If you ever used Xara Studio or CorelXARA then this is a pretty good clone of them. It has trouble with high DPI screens, and a few other quirks, so I don’t know how much love it gets from the upstream developers these days, but it’s still a very useful tool for me.

(Ok, I looked at the bugtracker on the Inkscape project and they still seem pretty active)

Other installation required

Given the huge ecosystem of software available for Linux - and the considerable effort required to create Debian-style packages compatible with APT - not all software is available from APT, or where it is it may be maintained in a less timely fashion than is necessary for a developer who expects particular versions of tools to be available.

The following tools require other installation approaches.

Apache Maven

Much as I love the APT tooling, it’s generally woefully out of date when it comes to Java libraries and applications. I generally don’t trust it for anything other than the base Open JDK installation (and even there it can be problematic). I therefore need to install some things manually. First and foremost is Maven, the venerable build and dependency management tool.

I usually download the version(s) I need from the Apache Maven website into my /opt directories, and then use update-alternatives to install it/them as first-class command line tools. If you habitually install arbitrary binaries to your local workstation then it’s well worth getting to know the update-alternatives tools. I admit I usually have to look up the syntax when I want to do that though. I really must write up a post expounding the set of operations that I usually want for this :)

Rust

Another of my aspirational goals is that I’m aiming to become proficient in Rust over the next few years. Rust moves fast, so the version available from APT is quite old. I therefore skip the APT route to installation and install direct from the Rust website.

Once installed initially the provided rustup tool can be used to ensure you’re at the latest version.

Spring Tool Suite

Although many Java developers absolutely swear by IntelliJ IDEA as their IDE of choice I still find that I’m most productive when using Eclipse. Better even than Eclipse is the Spring Tool Suite from Pivotal (basically Eclipse with a bunch of custom plugins for working with Spring).

Spring Tool Suite (STS) is not available under APT and the version of Eclipse that is available is again likely to be out of date. It’s therefore a download from the Spring tools website to get this.

I install STS under my /opt directories.

AWS CLI

For working with Amazon Web Services the command line tools are are a vital part of my day-to-day routine. These are installed using pip3 via the following command:

pip3 install awscli --upgrade --user

Conclusion

The opensource ecosystem for developers is quite extraordinary, and it gets easier and easier to bring a tailored development environment up and running on Linux - and specifically on Ubuntu. These are just a few of my favourites and I hope some of them are new to you too.

Update: Between starting and finishing the writing of this article I had to set up yet another work laptop on a client site - so I can confirm that this is still the core of my day-to-day toolkit!

Enjoy.