目标机器的配置:
redhat CentOS 7.2.1511
下载graphviz安装包:
http://204.178.9.49/Download_linux_rhel.php
下载graphviz-2.41.20171026.1811-1.el7.src.rpm
由于没有root权限,无法使用yum进行安装。故采用以下方法安装:
Step1:把RPM包解压出来,解压的命令为:
rpm2cpio graphviz-2.41.20171026.1811-1.el7.src.rpm | cpio -idvm
解压后得到两个文件:
graphviz.spec
graphviz-2.41.20171026.1811.tar.gz
Step2: 解压graphviz-2.41.20171026.1811.tar.gz文件
tar -xzvf graphviz-2.41.20171026.1811.tar.gz
得到graphviz-2.41.20171026.1811文件夹
Step3: 进入graphviz-2.41.20171026.1811文件夹,执行以下命令
./configure --install-prefix=/home/XXX/graphviz
make
make install
至此完成安装,安装路径为/home/XXX/graphviz
为了方便使用,应将上述路径放到环境变量中。
graphviz示例:
编辑simple_graph.dot文件,文件内容为:
digraph startgame {
label="游戏资源更新流程"
rankdir="TB"
start[label="启动游戏" shape=circle style=filled]
ifwifi[label="网络环境判断是否 WIFI" shape=diamond]
needupdate[label="是否有资源需要更新" shape=diamond]
startslientdl[label="静默下载" shape=box]
enterhall[label="进入游戏大厅" shape=box]
enterroom[label="进入房间" shape=box]
resourceuptodate[label="资源不完整" shape=diamond]
startplay[label="正常游戏" shape=circle fillcolor=blue]
warning[label="提醒玩家是否更新" shape=diamond]
startdl[label="进入下载界面" shape=box]
//{rank=same; needupdate, enterhall}
{shape=diamond; ifwifi, needupdate}
start -> ifwifi
ifwifi->needupdate[label="是"]
ifwifi->enterhall[label="否"]
needupdate->startslientdl[label="是"]
startslientdl->enterhall
needupdate->enterhall[label="否"]
enterhall -> enterroom
enterroom -> resourceuptodate
resourceuptodate -> warning[label="是"]
resourceuptodate -> startplay[label="否"]
warning -> startdl[label="确认下载"]
warning -> enterhall[label="取消下载"]
startdl -> enterhall[label="取消下载"]
startdl -> startplay[label="下载完成"]
}
使用命令生成图:
dot -Tpdf -o simple_graph.pdf simple_graph.dot