Install GD library and freetype on Linux

119,701

Solution 1

Installing GD :

For CentOS / RedHat / Fedora :

sudo yum install php-gd

For Debian/ubuntu :

sudo apt-get install php5-gd

Installing freetype :

For CentOS / RedHat / Fedora :

sudo yum install freetype*

For Debian/ubuntu :

sudo apt-get install freetype*

Don't forget to restart apache after that (if you are using apache):

CentOS / RedHat / Fedora :

sudo /etc/init.d/httpd restart

Or

sudo service httpd restart

Debian/ubuntu :

sudo /etc/init.d/apache2 restart

Or

sudo service apache2 restart

Solution 2

Things are pretty much simpler unless they are made confusing.

To Install GD library in Ubuntu

sudo apt-get install php5-gd

To Install Freetype in Ubuntu

sudo apt-get install libfreetype6-dev:i386

Solution 3

For CentOS: When installing php-gd you need to specify the version. I fixed it by running: sudo yum install php55-gd

Solution 4

Installing freetype:

sudo apt update && sudo apt install freetype2-demos

Share:
119,701
C A Mc
Author by

C A Mc

Updated on February 01, 2020

Comments

  • C A Mc
    C A Mc over 4 years

    I'm trying to use imagefttext. And I need to have GD library and/or freetype installed. I'm new to this kind of stuffs, How can I install GD library and freetype in Linux ?

  • C A Mc
    C A Mc over 10 years
    I'm using ubuntu, so I just tried this with 'sudo apt-get install php5-gd'. However, it says PHP-GD is already the newest version. I'm guessing this means i have the GD library installed, so now I just need to enable Freetype somehow. The php wiki has this "To enable support for FreeType 2 add --with-freetype-dir=DIR ." but I have no idea what that means.
  • C A Mc
    C A Mc over 10 years
    freetype won't work, it says it is unable to locate package freetype
  • Alireza Fallah
    Alireza Fallah over 10 years
    Im not using ubunto to test it, but its my first result of search how to install freetype in ubunto . you can search too
  • k__gc_im_o_
    k__gc_im_o_ almost 10 years
    write freetype* instead of freetype
  • Paul
    Paul almost 10 years
    In 14.04 LTS, installing php5-gd took care of Freetype as well (so only php5-gd needed to be installed).
  • k__gc_im_o_
    k__gc_im_o_ almost 10 years
    I don't know either, You should ask it from the person who add it on the repository. For all I know It maybe there under the name of "freetype*" instead of "freetype"
  • Dave Hilditch
    Dave Hilditch over 9 years
    This is why my Wordpress thumbnails weren't being built
  • Alireza Fallah
    Alireza Fallah over 9 years
    @DaveHilditch - Yes, you have to install it for generating wordpress thumbnails.
  • rebellion
    rebellion over 8 years
    Do you have to activate the module for PHP also?
  • Alireza Fallah
    Alireza Fallah over 8 years
    @ronnyandre, no, you dont need to
  • Andrew
    Andrew over 8 years
    don't forget to restart apache: sudo service apache2 restart
  • eQ19
    eQ19 over 8 years
    I'm on aws linux with PHP Version 5.6.17 sudo yum install php56-gd works on my site. Thanks.
  • ch271828n
    ch271828n over 3 years
    apt-get install libfreetype6-dev works for me!