文章 http://blog.csdn.net/zklth/archive/2010/09/28/5912785.aspx 介紹的是使用CentOS預設的SystemTap,這裡介紹使用SystemTap源碼獨立安裝SystemTap.
源碼
SystemTap: ftp://sources.redhat.com/pub/systemtap/
SystemTap: ftp://sources.redhat.com/pub/systemtap/releases/
elfutils: https://fedorahosted.org/releases/e/l/elfutils/
SystemTap需要elfutils的支援,並且相應的 elfutils 版本還不能太老,否則執行SystemTap的 ./configure 時會出現如下錯誤:
error: elfutils, libdw too old, need 0.126+
但是安裝SystemTap之前並不是要首先安裝 elfutils ,而是在配置 SystemTap 時指定與 elfutils 相關的參數,使得在編譯安裝SystemTap時自動編譯
--------------------------------------------------
cd /local/zkl/systemtap-1.1
./configure --with-elfutils=/local/zkl/elfutils-0.137 --prefix=/local/zkl/SystemTap
( 配置systemtap安裝參數,指定 elfutils 的源碼目錄以及SystemTap的安裝路徑 )
make
make install
執行完畢,SystemTap安裝在 /local/zkl/SystemTap 下
--------------------------------------------------
[root@hdfs05 SystemTap]# ls
bin etc include lib libexec share
[root@hdfs05 SystemTap]# bin/stap -V
SystemTap translator/driver (version 1.1/0.137 non-git sources)
Copyright (C) 2005-2009 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
系統預設安裝的SystemTap可以不用卸載,因為卸載時可能會卸載一些其它相關的包,以下是查看系統預設安裝的 systemtap,
[root@hdfs05 SystemTap]# rpm -q systemtap
systemtap-0.6.2-1.el5
我們只需要通過配置環境變數就能使執行命令時首先在我們安裝的SystemTap中尋找命令:
vim ~/.bashrc
export PATH=/local/zkl/SystemTap/bin:$PATH
source ~/.bashrc
[root@hdfs05 SystemTap]# stap -V
SystemTap translator/driver (version 1.1/0.137 non-git sources)
Copyright (C) 2005-2009 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
========================