1. 先下载了http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.38.0.tar.gz,安装后写了个测试例子:
#test1.dot
digraph example2 {
Server1 -> Server2; Server2 -> Server3; Server3 -> Server1; }
执行测试程序:
dot test1.dot -Tpng -o test1.png
显示错误:
Format: "png" not recognized. Use one of: canon cmap cmapx cmapx_np dot fig gd gif hpgl imap imap_np ismap mif mp pcl pic plain plain-ext ps ps2 svg vml vtx wbmp xdot
2. 尝试安装graphviz-gd库
yum install graphviz.x86_64
yum install graphviz-gd.x86_64
无效
3. 尝试安装libpng & gd库:
wget "http://prdownloads.sourceforge.net/libpng/libpng-1.6.17.tar.gz?download"
下载 https://codeload.github.com/libgd/libgd/tar.gz/gd-2.1.0
无效
4. 根据一篇帖子,选择安装低版本的graphviz:
http://weibo.com/p/23041868f23d9f0102vfbw?pids=Pl_Official_CardMixFeed__4&feed_filter=1&sudaref=www.google.com.hk
然后:
http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.26.0.tar.gz
安装后再执行
dot test1.dot -Tpng -o test1.png
出现错误:
Could not find/open font
shit
5. 认真看http://www.graphviz.org/Download..php提供的资源,然后下载:
http://www.graphviz.org/Misc/fonts.tgz
然后修改dot文件:
digraph example2 {
fontpath="/data/temp/ttf";
Server1 -> Server2; Server2 -> Server3; Server3 -> Server1; }
再次执行测试:
dot test1.dot -Tpng -o test1.png
终于好了!