[Linux] RPM 패키지 상세 정보 확인하기

rpm 명령어를 사용하여 RPM 패키지 설치 및 이름, 버전, 빌드 시간 등의 상세 정보를 확인할 수 있는데요. 저는 rpm 명령어를 통해 Ansible로 Deploy 시 Deploy 환경의 RPM 패키지 버전 등의 상세 정보를 확인하여 버전에 따라 로직을 구분할 때 사용하였습니다.

 

 

 

rpm 명령어에 -qip 옵션을 추가하여 RPM 패키지를 지정하면 아래와 같이 이름, 버전, 빌드 시간 등의 상세 정보를 확인하실 수 있습니다.

# rpm -qip ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm
Name        : ntp
Version     : 4.2.6p5
Release     : 29.el7.centos.2
Architecture: x86_64
Install Date: (not installed)
Group       : System Environment/Daemons
Size        : 1434385
License     : (MIT and BSD and BSD with advertising) and GPLv2
Signature   : RSA/SHA256, 2020년 06월 24일 (수) 오전 02시 36분 52초, Key ID 24c6a8a7f4a80eb5
Source RPM  : ntp-4.2.6p5-29.el7.centos.2.src.rpm
Build Date  : 2020년 06월 24일 (수) 오전 12시 38분 26초
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.ntp.org
Summary     : The NTP daemon and utilities
Description :
The Network Time Protocol (NTP) is used to synchronize a computer's
time with another reference time source. This package includes ntpd
(a daemon which continuously adjusts system time) and utilities used
to query and configure the ntpd daemon.

Perl scripts ntp-wait and ntptrace are in the ntp-perl package,
ntpdate is in the ntpdate package and sntp is in the sntp package.
The documentation is in the ntp-doc package.

 

 

rpm 명령어의 다양한 옵션을 사용할 수 있으며 아래 링크를 통해 추가적인 옵션을 확인하시기 바랍니다.
https://rpm-software-management.github.io/rpm/man/rpm.8.html

[Linux] Rocky 설치하기

현재 많이 사용하고 있는 Linux 배포판인 CentOS 7의 EOL이 2024년 6월 30일로 얼마 남지 않았습니다. 이에 따라 CentOS 7을 사용하는 많은 분들이 어떤 OS로 넘어갈지 고민에 빠져있을 것 같습니다. CentOS 7을 대체하기 위해서 Rocky Linux가 주목받고 있으며있으며 Rocky Linux를 설치하는 방법을 알아봅시다.

 

 

ISO 파일 다운로드

Rocky Linux 공식 홈페이지에서 최신 Rocky Linux 8 버전을 다운로드 받습니다.
최신 버전은 2022년 11월 14일에 Release된 8.7 버전입니다.
https://rockylinux.org/download/

 

 

Rocky Linux 설치

Rocky Linux의 기본적인 설치 방법은 CentOS 7과 거의 동일하며 기존에 CentOS 7을 설치해보신 분들이라면 편하게 설치를 진행하실 수 있을 것 같습니다. 저는 Rocky Linux를 설치하기 위해 Hyper-V를 통해 진행하였습니다.

 

 

VM 실행 후 Rocky Linux 8 설치 화면에서 Install Rocky Linux 8을 선택합니다.

 

 

로딩 화면 후 설치 화면이 나오는데요. CentOS 7과 거의 동일한 것을 확인하실 수 있습니다. 언어 설정은 영어를 선택 후 넘어갑니다.

 

설치 메뉴 중 아래 화면에 체크한 항목을 설정 후 설치를 진행해보도록 하겠습니다.

 

첫 번째로는 TIME & DATE 설정입니다. Asia/Seoul로 설정합니다. 시간 설정은 설치 완료 후에도 수동으로 변경할 수 있습니다.

 

두 번째로는 SOFTWARE SELECTION 설정입니다. 저는 필요한 패키지만 설치하여 사용하기 위해 Server With GUI가 아닌 Minimal Install을 선택하였습니다. 기본 서버에 필요한 패키지를 설치하시려면 Server, 추가로 GUI 화면이 필요하시면 Server With GUI을 선택하시면 됩니다.

 

 

세 번째로는 INSTALLATION DESTINATION 설정입니다. 저는 수동으로 디스크를 설정하기위해 Custom을 선택하였습니다. 자동으로 설정되는 Automatic을 설정하셔도 상관 없습니다.

 

기본 디스크가 설정되도록 Click here to create them automatically를 선택합니다.

 

/home 디렉토리를 사용하지 않고 / 디렉토리만을 사용하기 위해 /home 디렉토리를 삭제하고 남은 디스크 용량을 / 디렉토리에 할당합니다.

 

설정 변경사항을 확인 후 적용합니다.

 

네 번째로는 KDUMP 설정입니다. 기본 설정은 사용하도록 체크되어있으며 사용하지 않을 것이므로 해제합니다.

 

마지막으로 ROOT PASSWORD 설정입니다. 설정하고자하는 ROOT PASSWORD를 입력하여 설정합니다.

 

설정이 완료되면 Begin Installation 버튼을 클릭하여 설치를 진행합니다.

 

설치가 진행되고 완료되면 Reboot System 버튼을 클릭하여 시스템을 재시작 합니다.

 

 

이제 시스템 부팅이 완료되면 설치된 Rocky Linux 커널 버전을 확인하실 수 있고, 로그인을 통해 Rocky Linux를 사용하실 수 있습니다.

 

 

 

지금까지 Rocky Linux를 간단히 설치하는 방법을 알아보았습니다...! 끝...!

 

 

[Linux] 문자열 앞, 마지막 부분 출력하기

리눅스 head 명령어를 통해 문자열의 앞부분을 확인하거나 tail 명령어로 마지막 부분을 출력할 수 있습니다.

 

 

테스트 시 활용할 text 파일 내용

# cat text
An apple is a fruit.
The sky is blue.
Today is Monday.
Cutting paper with scissors.
Trees grow on the ground.
The sun rises in the east.
The earth is round.
The winter night air is cold.
Drinking water every morning.
The bus has already left.

 

 

문자열 앞부분 출력하기

  • 문자열 앞부분 두번째 줄까지 출력하기
  • -n 옵션을 사용하거나 직접 -2 숫자를 지정할 수 있습니다.
# cat text | head -n 2
An apple is a fruit.
The sky is blue.

# cat text | head -2
An apple is a fruit.
The sky is blue.

 

  • 문자열 앞부분부터 특정 바이트 단위까지 출력하기
  • -c 옵션 사용
# cat text | head -c 50
An apple is a fruit.
The sky is blue.
Today is Mon

 

 

문자열 마지막 부분 출력하기

  • 문자열 마지막 부분 세번째 줄까지 출력하기
  • -n 옵션을 사용하거나 직접 -2 숫자를 지정할 수 있습니다.
# cat text | tail -n 3
The winter night air is cold.
Drinking water every morning.
The bus has already left.

# cat text | tail -3
The winter night air is cold.
Drinking water every morning.
The bus has already left.

 

  • 문자열 마지막 부분부터 특정 바이트 단위까지 출력하기
  • -c 옵션 사용
# cat text | tail -c 50
ng water every morning.
The bus has already left.

'Linux' 카테고리의 다른 글

[Linux] RPM 패키지 상세 정보 확인하기  (0) 2023.05.09
[Linux] Rocky 설치하기  (0) 2023.05.03
[Linux] 특정 문자열 기준으로 출력하기  (0) 2022.09.22

[Linux] 특정 문자열 기준으로 출력하기

sed 명령어를 활용하여 특정 문자열을 기준으로 출력을 제어해봅니다.

 

테스트 시 활용할 text 파일 내용

# cat text
An apple is a fruit.
The sky is blue.
Today is Monday.
Cutting paper with scissors.
Trees grow on the ground.
The sun rises in the east.
The earth is round.
The winter night air is cold.
Drinking water every morning.
The bus has already left.

 

특정 문자열이 포함된 문자열부터 끝까지 출력하기

문자열 Cutting paper 부터 끝까지 출력

# cat text | sed -n '/Cutting paper/,$p'
Cutting paper with scissors.
Trees grow on the ground.
The sun rises in the east.
The earth is round.
The winter night air is cold.
Drinking water every morning.
The bus has already left.

-n 옵션 : 패턴에 일치하는 값만 출력 / 콤마(,) : 범위 지정 / $ : 문자열 끝 명시 / p : 출력

 

특정 문자열부터 특정 문자열까지 출력하기

문자열 Cutting paper 부터 문자열 Drinking 까지 출력

# cat text | sed -n '/Cutting paper/,/Drinking/p'
Cutting paper with scissors.
Trees grow on the ground.
The sun rises in the east.
The earth is round.
The winter night air is cold.
Drinking water every morning.

-n 옵션 : 패턴에 일치하는 값만 출력 / 콤마(,) : 범위 지정 / p : 출력

 

특정 문자열부터 특정 문자열까지 제외하고 출력하기

문자열 Cutting paper 부터 문자열 Drinking 까지 제외하고 출력

# cat text | sed '/Cutting paper/,/Drinking/d'
An apple is a fruit.
The sky is blue.
Today is Monday.
The bus has already left.

콤마(,) : 범위 지정 / d : 제외

 

처음부터 특정 문자열까지 출력하기

문자열 Cutting paper 까지 출력

# cat text | sed -n '1,/Cutting paper/p'
An apple is a fruit.
The sky is blue.
Today is Monday.
Cutting paper with scissors.

-n 옵션 : 패턴에 일치하는 값만 출력 / 1 : 첫번째 열 / p : 출력

 

특정 문자열부터 특정 문자열까지의 범위에서 문자열 변경

문자열 sky 부터 문자열 night까지의 범위 중 blue 문자열을 dark 로 변경

# cat text | sed "/sky/,/night/s/blue/dark/g"
An apple is a fruit.
The sky is dark.
Today is Monday.
Cutting paper with scissors.
Trees grow on the ground.
The sun rises in the east.
The earth is round.
The winter night air is cold.
Drinking water every morning.
The bus has already left.

콤마(,) : 범위 지정 / s : 문자열 치환 / g : 전체 적용

'Linux' 카테고리의 다른 글

[Linux] RPM 패키지 상세 정보 확인하기  (0) 2023.05.09
[Linux] Rocky 설치하기  (0) 2023.05.03
[Linux] 문자열 앞, 마지막 부분 출력하기  (0) 2023.01.10

+ Recent posts