Skip to content


How to install JpGraph on linux server.

I use JpGraph for some websites I run. It’s a PHP package that produces good-looking graphs.

Installing JpGraph

We’re going to need to be able to extract some stuff from some CAB files for starters.
Re-enable the yum Dag repository by setting enabled=1 in /etc/yum.repos.d/Dag.repo orĀ  /etc/yum.repos.d/rhel-debuginfo.repo
Once that’s done, continue on. First we need to install cabextract, then get some Microsoft TT fonts or TTF fonts. See http://corefonts.sourceforge.net/
for updated instructions on that, otherwise:

[root@p-root /]# yum install cabextract
[root@p-root /]# mkdir /usr/src/msttcorefonts
[root@p-root /]# cd /usr/src/msttcorefonts
[root@p-root /]# wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
[root@p-root /]# rpmbuild -bb msttcorefonts-2.0-1.spec

The fonts should be downloaded from SourceForge and compiled into an RPM. The new RPM will reside under the standard RPM build architecture. Install it:

[root@proot /]# rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

Now for Jpgraph. Go to http://www.aditus.nu/jpgraph/jpdownload.php/
and get the download link for the latest version.

[root@proot /]# cd /srv/www
[root@proot /]# wget http://www.aditus.nu/jpgraph/jpdownload.php/
[root@proot /]# tar zxvf jpgraph-[version].tar.gz
[root@proot /]# ln -s jpgraph-[version]/ jpgraph
[root@proot /]# rm jpgraph-[version].tar.gz

The JpGraph code sits above any website document roots I might have set up. I can include Jpgraph into my web code and use it there, but the code itself is not directly accessible from the web.

Disable the Dag repository again by setting enabled=0 in /etc/yum.repos.d/Dag.repo

Configure JpGraph:)

Edit /srv/www/jpgraph/src/jpg-config.inc.php and set the following line:
DEFINE(”TTF_DIR”,”/usr/share/fonts/msttcorefonts/”);

Note: If fonts aren’t appearing in your graphs, make sure that you compiled PHP with the “-dir” options pointing to the right lib*.so files (/usr/lib)…:)

Enjoy linux…………………:)

Posted in php.

Tagged with , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.