Install Systemtap
Ubuntu
Add “Ubuntu ddebs” source file, and paste the following command in the command line:
codename=$(lsb_release -c | awk '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse
EOFIn Ubuntu 11.10, delete “universe, multiverse”, and change it to:
codename=$(lsb_release -c | awk '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${codename} main restricted
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted
deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted
EOFUbuntu Key authentication:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01Update the index:
sudo apt-get update -yInstall Systemtap:
sudo apt-get install -y systemtap gcc Install dbgsym:
sudo apt-get install linux-image-$(uname -r)-dbgsymVerify if Systemtap is installed successfully. If it displays “hello world” correctly, then the installation is successful:
stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'CentOS
Install systemtap:
yum install systemtap kernel-develDownload debuginfo:
First check the system kernel version:
uname -rmGo to http://debuginfo.centos.org/ to download the corresponding RPM package, and install it:
rpm -Uhv kernel-debuginfo-*rpmVerify if Systemtap is installed successfully. If it displays “hello world” correctly, then the installation is successful:
stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'