Record of how to install Systemtap on Ubuntu/CentOS system image

888u

Last update at :2024-07-09,Edit by888u

Because we need to install Systemtap on the server for some operation and maintenance needs, in this article Snail records how to install Systemtap on the Ubuntu/CentOS system image. You can refer to it if we need it.

First, Ubuntu

Add the Ubuntu ddebs source file and paste the following command on the command line:

codename=$(lsb_release -c | awk \\\'{print $2}\\')sudo tee /etc/apt/sources.list.d/ddebs.list << EOFdeb http://ddebs.ubuntu .com/ ${codename} main restricted universe multiversedeb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiversedeb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiversedeb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverseEOF

Among them, universe and multiverse are deleted in Ubuntu 11.10 and changed to:

codename=$(lsb_release -c | awk \\\'{print $2}\\')sudo tee /etc/apt/sources.list.d/ddebs.list << EOFdeb http://ddebs.ubuntu .com/ ${codename} main restricteddeb http://ddebs.ubuntu.com/ ${codename}-security main restricteddeb http://ddebs.ubuntu.com/ ${codename}-updates main restricteddeb http://ddebs .ubuntu.com/ ${codename}-proposed main restrictedEOF

Ubuntu Key certification:

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

Update 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 that Systemtap is installed successfully. If hello world is displayed correctly, the installation is successful:

stap -e \\’probe kernel.function(\\”sys_open\\”) {log(\\”hello world\\”) exit()}\\’

Second, CentOS

Install systemtap:

yum install systemtap kernel-devel

Download debuginfo:

Check the system kernel version first:

uname -rm

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

rpm -Uhv kernel-debuginfo-*rpm

Verify that Systemtap is installed successfully. If hello world is displayed correctly, the installation is successful:

stap -e \\’probe kernel.function(\\”sys_open\\”) {log(\\”hello world\\”) exit()}\\’

Reference article: https://docs.ucloud.cn/uhost/public/systemtap

Recommended site search: all-purpose virtual host, website server rental icp registration query system, website space rental, website registration query, forum registration, registration-free virtual host, website virtual host space, server, domain name space agent,

Record of how to install Systemtap on Ubuntu/CentOS system image

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码