소개
이번 실습에서는 DNF를 사용하여 Red Hat Enterprise Linux(RHEL) 시스템에서 소프트웨어 패키지를 관리하는 방법을 직접 실습해 봅니다. 먼저 시뮬레이션 환경에서도 Red Hat 지원 등록을 위한 subscription-manager 명령어의 개념을 이해하는 것으로 시작합니다. 그 후 RPM 패키지 정보를 조회하고 해석하는 방법을 살펴보고, DNF를 이용한 소프트웨어 패키지 설치와 제거를 마스터하게 됩니다.
또한, 이번 실습에서는 DNF 소프트웨어 저장소의 추가, 활성화 및 비활성화를 포함한 저장소 관리 방법을 안내합니다. 마지막으로 DNF 트랜잭션 기록을 조회하고 이해하는 방법을 배워 패키지 관리 작업에 대한 종합적인 시각을 기르게 됩니다.
참고: 이 실습은 패키지 다운로드 및 저장소 접근을 위해 네트워크 연결이 필요하며, LabEx Pro 사용자만 이용할 수 있습니다.
Red Hat 지원을 위한 시스템 등록
이번 단계에서는 subscription-manager 명령어를 사용하여 Red Hat 지원을 위해 시스템을 등록하는 방법을 배웁니다. 이 시뮬레이션 환경에서는 정식 Red Hat 서브스크립션(구독)을 사용할 수 없지만, subscription-manager 명령어를 이해하는 것은 Red Hat Enterprise Linux 시스템에서 소프트웨어를 관리하는 데 매우 중요합니다. 이 명령어를 사용하면 시스템을 Red Hat에 등록하고, 서브스크립션을 연결하며, 소프트웨어 패키지와 업데이트를 위한 Red Hat의 콘텐츠 전송 네트워크(CDN)에 접근할 수 있습니다.
먼저, 플레이스홀더(임시) 사용자 이름을 사용하여 시스템 등록을 시도해 보겠습니다. 실제 등록에는 유효한 Red Hat 자격 증명이 필요하지만, 이를 통해 명령어의 사용법을 확인할 수 있습니다.
sudo subscription-manager register --username labex --password labex 2>&1 | tee ~/project/subscription-register.txt
이 실습에서는 명령어가 대화형 입력 없이 실행될 수 있도록 플레이스홀더 자격 증명을 사용합니다. 이 환경에서는 예상대로 인증에 실패하게 되며, 그 결과는 검토를 위해 ~/project/subscription-register.txt에 저장됩니다.
Registering to: subscription.rhsm.redhat.com:443/subscription
Password:
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html (HTTP error code 401: Unauthorized)
마지막으로, 등록된 시스템에서 Red Hat 서브스크립션을 통해 어떤 저장소를 사용할 수 있는지 확인해 보겠습니다.
sudo subscription-manager repos --list 2>&1 | tee ~/project/subscription-repos.txt
시스템이 등록되지 않았으므로 서브스크립션 기반 저장소를 사용할 수 없다는 메시지가 표시됩니다.
This system has no repositories available through subscriptions.
다음으로, 이 시스템의 현재 서브스크립션 상태를 확인해 보겠습니다. 이는 Red Hat 서브스크립션 콘텐츠를 다루기 전에 시스템이 여전히 미등록 상태인지 확인하는 유용한 방법입니다.
sudo subscription-manager status 2>&1 | tee ~/project/subscription-status.txt
시스템이 등록되지 않았으므로 subscription-manager 버전에 따라 Not registered 또는 Unknown이 보고됩니다. 이 시뮬레이션 환경에서는 등록 시도가 실패한 후 Unknown 상태가 나타나며, 이는 시스템에 활성화된 서브스크립션이 없음을 의미합니다.
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Unknown
System Purpose Status: Unknown
이 실습은 등록 및 상태 확인을 위한 subscription-manager의 기본 사용법을 보여줍니다. 이 시뮬레이션 환경에서는 전체 기능이 제한되지만, 이러한 명령어들은 RHEL 시스템의 소프트웨어 접근 방식을 이해하는 데 기본이 됩니다.
RPM 패키지 정보 탐색
이번 단계에서는 rpm 명령어를 사용하여 소프트웨어 패키지를 조사하는 방법을 배웁니다. RPM(Red Hat Package Manager)은 Red Hat Enterprise Linux에서 사용하는 핵심 패키지 관리 시스템입니다. 나중에 살펴볼 dnf가 저장소에서 패키지를 관리하는 상위 수준의 도구라면, rpm은 개별 .rpm 파일을 직접 조회, 검증, 설치 및 제거할 수 있게 해줍니다.
먼저, 시스템에 설치된 모든 RPM 패키지 목록을 출력해 보겠습니다. 출력이 매우 길어질 수 있으므로, 결과를 head 명령어로 파이프(pipe)하여 앞부분만 확인합니다.
rpm -qa | head > ~/project/rpm-installed.txt
cat ~/project/rpm-installed.txt
패키지 이름, 버전, 아키텍처 목록이 표시됩니다. 예시:
libgcc-11.4.1-3.el9.x86_64
crypto-policies-20240202-1.git283706d.el9.noarch
tzdata-2024a-1.el9.noarch
subscription-manager-rhsm-certificates-20220623-1.el9.noarch
redhat-release-9.4-0.4.el9.x86_64
setup-2.13.7-10.el9.noarch
filesystem-3.16-2.el9.noarch
basesystem-11-13.el9.noarch
pcre2-syntax-10.40-5.el9.noarch
ncurses-base-6.2-10.20210508.el9.noarch
다음으로, 특정 파일이 어떤 패키지에서 제공되는지 확인해 보겠습니다. DNF 저장소 설정 파일이 포함된 디렉토리인 /etc/yum.repos.d를 예로 들어보겠습니다.
rpm -qf /etc/yum.repos.d
출력 결과는 이 디렉토리를 소유한 패키지를 보여줍니다.
redhat-release-9.4-0.4.el9.x86_64
이제 dnf 명령어를 제공하는 패키지에 대한 상세 정보를 확인해 보겠습니다.
DNF_PACKAGE=$(rpm -qf /usr/bin/dnf)
rpm -qi "$DNF_PACKAGE" > ~/project/dnf-package-info.txt
cat ~/project/dnf-package-info.txt
이 명령어들은 먼저 /usr/bin/dnf를 소유한 RPM을 파악한 후, 버전, 릴리스, 아키텍처, 라이선스, 요약 정보를 포함한 상세한 패키지 메타데이터를 표시합니다.
Name : dnf
Version : 4.14.0
Release : 9.el9
Architecture: noarch
Install Date: Thu Jul 18 15:50:10 2024
Group : Unspecified
Size : 2425281
License : GPLv2+
Signature : RSA/SHA256, Fri Nov 10 10:14:09 2023, Key ID 199e2f91fd431d51
Source RPM : dnf-4.14.0-9.el9.src.rpm
Build Date : Thu Oct 26 05:20:14 2023
Build Host : x86-64-01.build.eng.rdu2.redhat.com
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor : Red Hat, Inc.
URL : https://github.com/rpm-software-management/dnf
Summary : Package manager
Description :
Utility that allows users to manage packages on their systems.
It supports RPMs, modules and comps groups & environments.
패키지에 의해 설치된 모든 파일 목록을 확인할 수도 있습니다. 이는 패키지가 시스템에 어떤 파일을 배치하는지 이해하는 데 유용합니다.
rpm -ql dnf | head -n 10
dnf 패키지가 설치한 처음 10개의 파일이 표시됩니다.
/usr/bin/dnf
/usr/lib/systemd/system/dnf-makecache.service
/usr/lib/systemd/system/dnf-makecache.timer
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/dnf
/usr/share/locale/ar/LC_MESSAGES/dnf.mo
/usr/share/locale/bg/LC_MESSAGES/dnf.mo
/usr/share/locale/bn/LC_MESSAGES/dnf.mo
/usr/share/locale/bn_IN/LC_MESSAGES/dnf.mo
패키지가 설치한 설정 파일만 보려면 -qc 옵션을 사용합니다. openssh-clients 패키지를 확인해 보겠습니다.
rpm -qc openssh-clients
SSH 클라이언트와 관련된 설정 파일들이 나열됩니다.
/etc/ssh/ssh_config
/etc/ssh/ssh_config.d/50-redhat.conf
마지막으로, 패키지의 변경 로그(changelog) 정보를 보려면 --changelog를 사용합니다. 이를 통해 패키지의 업데이트 및 수정 내역을 파악할 수 있습니다. audit 패키지를 확인해 보겠습니다.
rpm -q --changelog audit | head -n 5
패키지가 설치되어 있지 않은 경우 오류 메시지가 표시됩니다.
package audit is not installed
대신 설치된 패키지로 시도할 수 있습니다. 예를 들어 setup 패키지의 경우:
rpm -q --changelog setup | head -n 5
이러한 rpm 명령어들은 시스템에 설치된 패키지와 그에 포함된 파일을 파악하는 강력한 도구입니다.
DNF를 이용한 소프트웨어 패키지 설치 및 제거
이번 단계에서는 dnf(Dandified YUM)를 사용하여 소프트웨어 패키지를 관리하는 방법을 배웁니다. dnf는 Red Hat Enterprise Linux 9의 기본 패키지 관리자로, 소프트웨어 패키지의 설치, 업데이트, 제거뿐만 아니라 소프트웨어 저장소 관리에도 사용됩니다. 종속성을 자동으로 처리하므로 rpm만 사용하는 것보다 소프트웨어 관리가 훨씬 쉬워집니다.
먼저, 이름에 "http"가 포함된 사용 가능한 모든 패키지와 설치된 패키지 목록을 확인해 보겠습니다. 이를 통해 HTTP 서비스와 관련된 패키지를 파악할 수 있습니다.
sudo dnf list 'http*'
패키지 목록과 함께 설치 여부 또는 설치 가능 여부가 표시됩니다.
Last metadata expiration check: 0:00:00 ago on Mon Apr 22 08:00:00 2024.
Available Packages
http-parser.i686 2.9.4-6.el9 rhel-9-for-x86_64-appstream-rpms
http-parser.x86_64 2.9.4-6.el9 rhel-9-for-x86_64-appstream-rpms
httpcomponents-client.noarch 4.5.13-2.el9 rhel-9-for-x86_64-appstream-rpms
httpcomponents-core.noarch 4.4.13-6.el9 rhel-9-for-x86_64-appstream-rpms
httpd.x86_64 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
httpd-devel.x86_64 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
httpd-filesystem.noarch 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
httpd-manual.noarch 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
httpd-tools.x86_64 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
이제 이름, 요약 또는 설명에 "web server"가 포함된 패키지를 검색해 보겠습니다. search all 옵션은 더 넓은 범위의 검색에 유용합니다.
sudo dnf search all 'web server'
이 명령어는 검색어와 일치하는 패키지 목록을 반환합니다.
Last metadata expiration check: 0:00:00 ago on Mon Apr 22 08:00:00 2024.
================== Summary & Description Matched: web server ===================
nginx.x86_64 : A high performance web server and reverse proxy server
pcp-pmda-weblog.x86_64 : Performance Co-Pilot (PCP) metrics from web server logs
========================= Summary Matched: web server ==========================
libcurl.x86_64 : A library for getting files from web servers
libcurl.i686 : A library for getting files from web servers
======================= Description Matched: web server ========================
freeradius.x86_64 : High-performance and highly configurable free RADIUS server
git-instaweb.noarch : Repository browser in gitweb
http-parser.i686 : HTTP request/response parser for C
http-parser.x86_64 : HTTP request/response parser for C
httpd.x86_64 : Apache HTTP Server
mod_auth_openidc.x86_64 : OpenID Connect auth module for Apache HTTP Server
mod_jk.x86_64 : Tomcat mod_jk connector for Apache
mod_security.x86_64 : Security module for the Apache HTTP Server
varnish.i686 : High-performance HTTP accelerator
varnish.x86_64 : High-performance HTTP accelerator
Apache HTTP Server인 httpd 패키지에 대한 상세 정보를 확인해 보겠습니다.
sudo dnf info httpd
크기, 라이선스, 설명을 포함한 패키지의 포괄적인 세부 정보가 표시됩니다.
Last metadata expiration check: 0:00:00 ago on Mon Apr 22 08:00:00 2024.
Available Packages
Name : httpd
Version : 2.4.51
Release : 5.el9
Architecture : x86_64
Size : 1.5 M
Source : httpd-2.4.51-5.el9.src.rpm
Repository : rhel-9-for-x86_64-appstream-rpms
Summary : Apache HTTP Server
URL : https://httpd.apache.org/
License : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
: web server.
이제 httpd 패키지를 설치해 보겠습니다. 이 작업을 수행하려면 sudo 권한이 필요합니다.
sudo dnf install httpd -y | tee ~/project/httpd-install.txt
-y 플래그는 모든 프롬프트에 자동으로 "yes"로 응답하므로 스크립트 작성에 유용하지만, 운영(Production) 환경에서는 주의해서 사용해야 합니다.
Last metadata expiration check: 0:00:00 ago on Mon Apr 22 08:00:00 2024.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
httpd x86_64 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
1.5 M
Installing dependencies:
apr x86_64 1.7.0-11.el9 rhel-9-for-x86_64-appstream-rpms
126 k
apr-util x86_64 1.6.1-20.el9 rhel-9-for-x86_64-appstream-rpms
106 k
apr-util-bdb x86_64 1.6.1-20.el9 rhel-9-for-x86_64-appstream-rpms
13 k
apr-util-openssl x86_64 1.6.1-20.el9 rhel-9-for-x86_64-appstream-rpms
15 k
httpd-filesystem noarch 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
14 k
httpd-tools x86_64 2.4.51-5.el9 rhel-9-for-x86_64-appstream-rpms
100 k
mailcap noarch 2.1.49-5.el9 rhel-9-for-x86_64-baseos-rpms
36 k
mod_http2 x86_64 1.15.7-5.el9 rhel-9-for-x86_64-appstream-rpms
150 k
redhat-logos-httpd noarch 90.4-1.el9 rhel-9-for-x86_64-appstream-rpms
20 k
Transaction Summary
================================================================================
Install 10 Packages
Total download size: 2.1 M
Installed size: 6.9 M
Downloading Packages:
... (downloading package details omitted) ...
Running transaction
... (installation progress omitted) ...
Installed:
apr-1.7.0-11.el9.x86_64
apr-util-1.6.1-20.el9.x86_64
apr-util-bdb-1.6.1-20.el9.x86_64
apr-util-openssl-1.6.1-20.el9.x86_64
httpd-2.4.51-5.el9.x86_64
httpd-filesystem-2.4.51-5.el9.noarch
httpd-tools-2.4.51-5.el9.x86_64
mailcap-2.1.49-5.el9.noarch
mod_http2-1.15.7-5.el9.x86_64
redhat-logos-httpd-90.4-1.el9.noarch
Complete!
rpm을 조회하여 httpd가 설치되었는지 확인할 수 있습니다.
rpm -q httpd
httpd-2.4.51-5.el9.x86_64
이제 httpd 패키지를 제거해 보겠습니다.
sudo dnf remove httpd -y | tee ~/project/httpd-remove.txt
이 명령어는 httpd 패키지 및 다른 설치된 패키지에서 더 이상 필요로 하지 않는 종속성 패키지들을 함께 제거합니다.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Removing:
httpd x86_64 2.4.51-5.el9 @appstream 4.7 M
Removing dependent packages:
apr-util-bdb x86_64 1.6.1-20.el9 @appstream 13 k
apr-util-openssl x86_64 1.6.1-20.el9 @appstream 15 k
httpd-filesystem noarch 2.4.51-5.el9 @appstream 14 k
mod_http2 x86_64 1.15.7-5.el9 @appstream 150 k
redhat-logos-httpd noarch 90.4-1.el9 @appstream 20 k
Transaction Summary
================================================================================
Remove 6 Packages
Freed space: 4.9 M
... (transaction progress omitted) ...
Removed:
apr-util-bdb-1.6.1-20.el9.x86_64
apr-util-openssl-1.6.1-20.el9.x86_64
httpd-2.4.51-5.el9.x86_64
httpd-filesystem-2.4.51-5.el9.noarch
mod_http2-1.15.7-5.el9.x86_64
redhat-logos-httpd-90.4-1.el9.noarch
Complete!
제거되었음을 다시 확인할 수 있습니다.
rpm -q httpd
package httpd is not installed
이것으로 소프트웨어 패키지 설치 및 제거를 위한 기본 dnf 명령어를 살펴보았습니다.
DNF 소프트웨어 저장소 관리
이번 단계에서는 DNF 소프트웨어 저장소(Repository)를 관리하는 방법을 배웁니다. 저장소는 소프트웨어 패키지가 저장되어 있는 장소이며, dnf는 이 저장소로부터 패키지를 가져옵니다. 시스템에서 사용할 수 있는 소프트웨어를 제어하려면 저장소 목록 조회, 활성화, 비활성화 및 추가 방법을 이해하는 것이 필수적입니다.
먼저, 설정된 모든 DNF 저장소와 그 상태(활성화 또는 비활성화)를 조회해 보겠습니다.
sudo dnf repolist all > ~/project/dnf-repolist.txt
cat ~/project/dnf-repolist.txt
저장소 ID, 이름 및 현재 상태 목록이 표시됩니다. 정확한 저장소 이름은 실습에 사용된 이미지에 따라 다를 수 있습니다.
repo id repo name status
rhui-rhel-10-for-x86_64-appstream-rhui-rpms Red Hat Enterprise enabled
rhui-rhel-10-for-x86_64-baseos-rhui-rpms Red Hat Enterprise enabled
rhui-rhel-10-for-x86_64-appstream-rhui-debug-rpms Red Hat Enterprise disabled
dnf config-manager 명령어는 저장소 설정을 관리하는 강력한 도구입니다. 이를 사용하여 저장소를 활성화하거나 비활성화할 수 있습니다. 예를 들어, 가상의 디버그 저장소를 활성화해 보겠습니다. 이 실습 환경에서는 이 특정 저장소가 존재하지 않거나 접근할 수 없을 수 있지만, 명령어 구문을 보여줍니다.
sudo dnf config-manager --enable rhel-9-server-debug-rpms 2>&1 | tee ~/project/dnf-enable-debug.txt
서브스크립션 관리 관련 메시지와 함께 저장소를 찾을 수 없다는 오류가 표시되며, 이는 이 환경에서 예상된 결과입니다.
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
Error: No matching repo to modify: rhel-9-server-debug-rpms.
이제 저장소를 비활성화해 보겠습니다. 예시로 rhel-9-for-x86_64-appstream-rpms를 사용합니다. 참고: 이 특정 저장소 이름은 현재 실습 이미지에 존재하지 않지만, 명령어 구문을 보여줍니다.
sudo dnf config-manager --disable rhel-9-for-x86_64-appstream-rpms 2>&1 | tee ~/project/dnf-disable-appstream.txt
서브스크립션 관리 메시지와 해당 환경에 저장소가 존재하지 않는다는 오류가 표시됩니다.
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
Error: No matching repo to modify: rhel-9-for-x86_64-appstream-rpms.
현재 시스템에 이 저장소 이름이 존재하지 않는지 확인해 보겠습니다.
sudo dnf repolist all | grep rhel-9-for-x86_64-appstream-rpms
예상대로 현재 실습 이미지에는 이 저장소가 존재하지 않으므로 출력이 없습니다.
(no output)
저장소가 존재하지 않음을 확인하기 위해 동일한 활성화 명령어를 다시 시도해 봅니다.
sudo dnf config-manager --enable rhel-9-for-x86_64-appstream-rpms 2>&1 | tee ~/project/dnf-enable-appstream.txt
다시 동일한 오류 메시지가 표시됩니다.
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
Error: No matching repo to modify: rhel-9-for-x86_64-appstream-rpms.
dnf config-manager --add-repo 명령어를 사용하면 URL을 지정하여 새 저장소를 추가할 수도 있습니다. 시연을 위해 일반적인 EPEL(Extra Packages for Enterprise Linux) 저장소 URL을 추가해 보겠습니다. (GPG 키나 특정 .repo 파일이 필요하므로 이것만으로는 저장소가 완전히 설정되지 않을 수 있지만, 명령어의 기능을 보여줍니다.)
sudo dnf config-manager --add-repo="https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/" 2>&1 | tee ~/project/dnf-add-repo.txt
새로운 .repo 파일이 생성되었음을 나타내는 출력이 표시됩니다.
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
Adding repo from: https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/
/etc/yum.repos.d/에서 새로 생성된 .repo 파일을 확인할 수 있습니다. 파일 이름은 URL에서 파생됩니다.
ls /etc/yum.repos.d/
기존 저장소 파일들과 함께 dl.fedoraproject.org_pub_epel_9_Everything_x86_64_.repo 같은 파일을 볼 수 있습니다.
dl.fedoraproject.org_pub_epel_9_Everything_x86_64_.repo redhat.repo ubi.repo
마지막으로, 정리를 위해 방금 추가한 저장소 설정 파일을 삭제합니다.
sudo rm /etc/yum.repos.d/dl.fedoraproject.org_pub_epel_9_Everything_x86_64_.repo
이 단계에서는 RHEL에서 소프트웨어 소스를 관리하는 데 필수적인 DNF 저장소 목록 조회, 활성화, 비활성화 및 추가 방법을 살펴보았습니다.
DNF 트랜잭션 기록 조회
이번 단계에서는 DNF 작업의 트랜잭션 기록을 조회하는 방법을 배웁니다. dnf는 모든 패키지 설치, 제거 및 업데이트에 대한 상세한 로그를 유지합니다. 이 기록은 문제 해결, 감사(Auditing), 그리고 필요한 경우 변경 사항을 되돌리는(Reverting) 데 매우 유용합니다.
먼저, 시스템에서 발생한 모든 DNF 트랜잭션의 요약을 조회해 보겠습니다.
sudo dnf history | tee ~/project/dnf-history.txt
ID, 사용된 명령줄, 날짜 및 시간, 수행된 작업, 변경된 패키지 수가 포함된 테이블이 표시됩니다.
ID | Command line | Date and time | Action(s) | Altered
--------------------------------------------------------------------------------
3 | install httpd | 2024-04-22 08:00 | Install | 10
2 | remove httpd | 2024-04-22 08:01 | Remove | 6
1 | | 2024-04-22 07:50 | Install | 767 EE
ID 컬럼은 특정 트랜잭션을 지정할 수 있게 해주므로 특히 중요합니다. 이 실습에서는 기록 출력에서 httpd 제거 트랜잭션 ID를 가져와 다음 명령어에서 재사용할 수 있습니다.
HTTPD_REMOVE_ID=$(sudo dnf history | awk '/remove httpd/ && $1 ~ /^[0-9]+$/ {print $1; exit}')
echo "$HTTPD_REMOVE_ID"
sudo dnf history info "$HTTPD_REMOVE_ID" | tee ~/project/dnf-history-info.txt
이 명령어는 제거된 패키지, 버전, 작업 이유를 포함하여 선택한 트랜잭션에 대한 포괄적인 내역을 제공합니다.
Transaction ID : 2
Begin time : Mon Apr 22 08:01:00 2024
Begin rpmdb : 777:a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7a8b9c0d1e2f3
End time : Mon Apr 22 08:01:05 2024 (5 seconds)
End rpmdb : 771:a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7a8b9c0d1e2f3
User : labex <labex>
Return Code : Success
Command Line : dnf remove httpd -y
Packages Altered:
Removed apr-util-bdb-1.6.1-20.el9.x86_64
Removed apr-util-openssl-1.6.1-20.el9.x86_64
Removed httpd-2.4.51-5.el9.x86_64
Removed httpd-filesystem-2.4.51-5.el9.noarch
Removed mod_http2-1.15.7-5.el9.x86_64
Removed redhat-logos-httpd-90.4-1.el9.noarch
DNF 기록의 가장 강력한 기능 중 하나는 트랜잭션을 취소(undo)하거나 다시 실행(redo)하는 기능입니다. 방금 가져온 HTTPD_REMOVE_ID 값을 사용하여 httpd 제거 트랜잭션을 취소해 보겠습니다.
sudo dnf history undo "$HTTPD_REMOVE_ID" -y | tee ~/project/dnf-history-undo.txt
이 명령어는 해당 트랜잭션에서 제거되었던 httpd 패키지와 종속성들을 다시 설치합니다.
Last metadata expiration check: 0:00:00 ago on Mon Apr 22 08:00:00 2024.
Undoing transaction 2, from Mon Apr 22 08:01:00 2024
Removed apr-util-bdb-1.6.1-20.el9.x86_64
Removed apr-util-openssl-1.6.1-20.el9.x86_64
Removed httpd-2.4.51-5.el9.x86_64
Removed httpd-filesystem-2.4.51-5.el9.noarch
Removed mod_http2-1.15.7-5.el9.x86_64
Removed redhat-logos-httpd-90.4-1.el9.noarch
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
httpd x86_64 2.4.51-5.el9 ubi-9-appstream-rpms 1.5 M
Installing dependencies:
apr x86_64 1.7.0-11.el9 ubi-9-appstream-rpms 126 k
apr-util x86_64 1.6.1-20.el9 ubi-9-appstream-rpms 106 k
apr-util-bdb x86_64 1.6.1-20.el9 ubi-9-appstream-rpms 13 k
apr-util-openssl x86_64 1.6.1-20.el9 ubi-9-appstream-rpms 15 k
httpd-filesystem noarch 2.4.51-5.el9 ubi-9-appstream-rpms 14 k
httpd-tools x86_64 2.4.51-5.el9 ubi-9-appstream-rpms 100 k
mailcap noarch 2.1.49-5.el9 ubi-9-baseos-rpms 36 k
mod_http2 x86_64 1.15.7-5.el9 ubi-9-appstream-rpms 150 k
redhat-logos-httpd noarch 90.4-1.el9 ubi-9-appstream-rpms 20 k
Transaction Summary
================================================================================
Install 10 Packages
Total download size: 2.1 M
Installed size: 6.9 M
... (installation progress omitted) ...
Complete!
httpd가 다시 설치되었는지 확인할 수 있습니다.
rpm -q httpd
httpd-2.4.51-5.el9.x86_64
마지막으로, 향후 실습을 위해 시스템을 깨끗한 상태로 유지하기 위해 httpd를 다시 제거합니다.
sudo dnf remove httpd -y | tee ~/project/dnf-history-final-remove.txt
... (output omitted) ...
Complete!
이 단계에서는 dnf history를 사용하여 DNF 트랜잭션을 조회, 검사 및 되돌리는 방법을 살펴보았으며, 이를 통해 시스템 관리를 위한 강력한 기능을 경험했습니다.
요약
이번 실습에서는 DNF를 사용하여 Red Hat Enterprise Linux에서 소프트웨어 패키지를 관리하는 필수 기술을 배웠습니다. 시뮬레이션 환경에서는 전체 등록을 완료할 수 없었지만, 시스템을 Red Hat에 등록하고 콘텐츠 전송 네트워크에 접근하는 데 필수적인 subscription-manager 명령어의 개념을 이해하는 것으로 시작했습니다.
그 후 RPM 패키지 정보 조회, DNF를 이용한 소프트웨어 설치 및 제거, DNF 소프트웨어 저장소 관리, 그리고 DNF 트랜잭션 기록 조회 방법을 실습했습니다. 이러한 단계들을 통해 효율적인 소프트웨어 관리를 위한 DNF의 기능들을 종합적으로 익힐 수 있었습니다.



