Call to undefined function Drupal\Component\Utility\imagecreate() I got this error on a server I setup and was confused:


  Error: Call to undefined function Drupal\Component\Utility\imagecreate() in Drupal\Component\Utility\Random->image() (line 282 of /var/lib/jenkins/src/grls/docroot/core/lib/Drupal/Component/Utility/Random.php
The imagecreate function is part of php's gd library. If a server has been set up manually it's possible it doesn't have the gd library. 

First, figure out which version of php you are using, for example with this command:

dpkg -l | grep '^ii' | grep php

Look for a line like:

ii  php7.2     7.2.19-0ubuntu0.18.04.2           all          server-side, HTML-embedded scripting language (metapackage)


That indicates the server is using php7.2. To install gd library for php7.2 on a system managed with apt you need a command something like:

sudo apt install php7.2-gd

And then the error will be gone.