If the system is Debian based server such as Ubuntu then run this command:
apt-get install php5-gd
After completion, to restart the apache2 web server run this:
/etc/init.d/apache2 restart
This will restart your server and also enable GD in PHP
If not Ubuntu or a Linux based server, try yum install
For PHP7.x and above use the below command:
sudo apt-get install php7.0-gd
and then restart your web server.