# 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
    EOF

In 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
    EOF

Ubuntu Key authentication:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01

Update the index:

    sudo apt-get update -y

Install Systemtap:

``` 
sudo apt-get install -y systemtap gcc 
```

Install dbgsym:

    sudo apt-get install linux-image-$(uname -r)-dbgsym

Verify 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-devel

Download debuginfo:

First check the system kernel version:

    uname -rm

Go to http://debuginfo.centos.org/ to download the corresponding RPM package, and install it:

    rpm -Uhv kernel-debuginfo-*rpm

Verify 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()}'
