install gd library ubuntu code example
Example: install gd extension php ubuntu
#install gd extension, 7.4 replace it with your version
sudo apt-get install php7.4-gd
#check if installed
php -m | grep gd
#restart your web server
sudo service apache2 restart
or
sudo service nginx restart