WordPress Error: Error cropping images [FIX]

I recently installed WP on a new server (this one!), and everything worked, except when I tried uploading images, it always failed in the cropping process, with an error message along the lines of “error cropping image.”

In a google search I found a reference from someone with the same problem, and managed to apply their advice to my Ubuntu 18.04 build (different library name, I had to do some translating.) You need to install a library called php-gd, and restart your web server, and the problem vanishes. (At least it did for me!)