본문으로 건너뛰기

[Linux] Install sosreport on Amazon Linux 2023

sos(sosreport) 명령이 기본 제공되지 않는 Amazon Linux 2023에 GitHub 소스로 sos를 수동 설치하고 sos report로 진단 정보를 수집하는 방법을 정리합니다.

요약

  • Amazon Linux 2023에는 sos 명령이 기본 제공되지 않지만, GitHub 소스를 clone해 python3 setup.py install로 수동 설치할 수 있습니다.
  • 설치 후 sudo sos report를 실행하면 시스템 구성과 진단 정보가 /var/tmp/ 아래 tar.xz 압축 파일로 생성됩니다.

테스트 환경 Amazon Linux 2023 (Release 2023.3.20240312), sos 4.7.0

Amazon Linux 2023 에 sosreport (sos) 설치

sos 는 시스템의 로그 및 구성 요소를 수집하고 저장하는 유용한 도구입니다.
하지만 기본적으로 Amazon Linux 는 sos(sosreport) 명령어가 제공이 안됩니다.

이번 포스팅은 sos 를 수동 설치 하는 방법에 대해 알아보도록 하겠습니다.

설치

  • 테스트 환경 : Amazon Linux 2023
  • Release Version : 2023.3.20240312

아래와 같이 sos 설치에 필요한 패키지를 설치합니다.

$ sudo dnf -y install git python3-pip python3-magic

다음 sos github repository 를 clone 합니다.

$ sudo git clone https://github.com/sosreport/sos.git

아래와 같이 sos 명령어에 필요한 python module 을 추가 설치합니다.

$ cd sos/
$ sudo pip install -r requirements.txt

sos.conf 파일을 경로에 복사합니다.

$ sudo mkdir /etc/sos
$ cp sos.conf /etc/sos/

아래 명령어를 이용하여 sos 명령어를 설치합니다.

$ sudo python3 setup.py install

위 과정이 완료되면 아래와 같이 패키지가 설치가 완료된 것을 볼 수 있습니다.

$ sudo which sos
/usr/local/bin/sos

테스트

아래와 같이 테스트를 수행합니다.

$ sudo sos report

sosreport (version 4.7.0)

This command will collect system configuration and diagnostic
information from this Amazon Linux system.

For more information on Amazon visit:

        Distribution Website : https://aws.amazon.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


Press ENTER to continue, or CTRL-C to quit.  <ENTER>

Optionally, please enter the case id that you are generating this report for []: <ENTER>

 Setting up archive ...
 Setting up plugins ...

 ...Skip

Creating compressed archive...

Your sosreport has been generated and saved in:
	/var/tmp/sosreport-ip-172-31-1-4-2024-03-18-kausmsr.tar.xz

 Size	8.69MiB
 Owner	root
 sha256	8d534b91e48b2a85d9b5deb9635b62495b0708d59075532d54355dde26a6ee67

Please send this file to your support representative.

참고 문서

자주 묻는 질문

Amazon Linux 2023에서 sosreport 명령을 사용할 수 있나요?

기본적으로는 제공되지 않습니다. sosreport/sos GitHub 저장소를 clone한 뒤 pip install -r requirements.txt와 python3 setup.py install로 수동 설치하면 사용할 수 있습니다.

sos를 소스로 설치하기 전에 필요한 패키지는 무엇인가요?

sudo dnf -y install git python3-pip python3-magic로 git, python3-pip, python3-magic을 설치합니다. 또한 /etc/sos 디렉터리를 만들고 sos.conf를 복사해 둡니다.

sos report로 생성된 결과 파일은 어디에 저장되나요?

/var/tmp/ 경로에 sosreport-<호스트명>-<날짜>-...tar.xz 형태의 압축 파일로 저장됩니다.