Rpm

From 탱이의 잡동사니
Revision as of 08:30, 18 August 2017 by Pchero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

RPM 패키지 매니저(RPM Package Manager- Red Hat Package Manager) 사용법 소개

Basic

RPM 명령어는 RPM 패키지를 관리할 때 사용하는 명령어이다.

Upgrade/remove/search/verify 등을 한다.

$ rpm help
RPM version 4.7.2
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

Usage: rpm [-aKfgpWHqVcdilsKiv?] [-a|--all] [-f|--file] [-g|--group]
        [-p|--package] [-W|--ftswalk] [--pkgid] [--hdrid] [--fileid]
        [--specfile] [--triggeredby] [--whatrequires] [--whatprovides]
        [--nomanifest] [-c|--configfiles] [-d|--docfiles] [--dump] [-l|--list]
        [--queryformat=QUERYFORMAT] [-s|--state] [--nofiledigest] [--nomd5]
        [--nofiles] [--nodeps] [--noscript] [--comfollow] [--logical]
        [--nochdir] [--nostat] [--physical] [--seedot] [--xdev]
        [--whiteout] [--addsign] [-K|--checksig] [--delsign] [--import]
        [--resign] [--nodigest] [--nosignature] [--initdb] [--rebuilddb]
        [--aid] [--allfiles] [--allmatches] [--badreloc]
        [-e|--erase <package>+] [--excludedocs] [--excludepath=<path>]
        [--fileconflicts] [--force] [-F|--freshen <packagefile>+] [-h|--hash]
        [--ignorearch] [--ignoreos] [--ignoresize] [-i|--install] [--justdb]
        [--nodeps] [--nofiledigest] [--nomd5] [--nocontexts] [--noorder]
        [--nosuggest] [--noscripts] [--notriggers] [--oldpackage]
        [--percent] [--prefix=<dir>] [--relocate=<old>=<new>]
        [--replacefiles] [--replacepkgs] [--test]
        [-U|--upgrade <packagefile>+] [--quiet] [-D|--define 'MACRO EXPR']
        [-E|--eval 'EXPR'] [--macros=<FILE:...>] [--nodigest] [--nosignature]
        [--rcfile=<FILE:...>] [-r|--root ROOT] [--querytags] [--showrc]
        [--quiet] [-v|--verbose] [--version] [-?|--help] [--usage]
        [--scripts] [--setperms] [--setugids] [--conflicts] [--obsoletes]
        [--provides] [--requires] [--info] [--changelog] [--xml]
        [--triggers] [--last] [--dupes] [--filesbypkg] [--fileclass]
        [--filecolor] [--fscontext] [--fileprovide] [--filerequire]
        [--filecaps]

Options

-e|--erase <package>+

RPM 패키지 삭제 명령어. 지정된 패키지를 삭제한다.

$ rpm -e <package name>

--oldpackage <packagefile>

이전 버전의 패키지를 설치한다.

$ sudo rpm -Uvh --oldpackage test-package-1.3.0-63.fc12.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:test-package           ########################################### [100%]

-U|--upgrade <packagefile>+

RPM 패키지 업그레이드 명령어. 보통은 -vh 옵션을 붙여서 사용한다.

$ rpm -Uvh <package name>
$ rpm -ivh <package name>

특정 패키지를 재설치 해야할 경우(해킹을 당해서 패키지 내용이 변경된 경우..), 대부분은 삭제 -> 설치를 하면 해결이 된다.하지만 의존성이 심한 패키지같은 경우, 재설치를 위해 삭제를 할 경우, 원치않은 다른 패키지까지 주루룩 삭제되는 경우가 있다. 이런 경우, 다음과 같이 --force 옵션을 함께 사용해주면 된다.

$ rpm -Uvh --force <package name>

의존성 검사를 무시하고 설치하고자 할때는 --nodeps 를 붙여서 사용해주면 된다.

$ sudo rpm -Uvh --nodeps voicemail-1-21.fc12.x86_64.rpm 
Preparing...                ########################################### [100%]
	package voicemail-1-21.fc12.x86_64 is already installed

--test

실제로 패키지를 설치하지 않는다. 의존성 검사와 같은 테스트만 수행한다.

$ rpm -Uvh --test test_package-1.0.0-0.el6.x86_64.rpm 
error: Failed dependencies:
	sample-package is needed by test_package-1.0.0-0.el6.x86_64
	sample-package-devel is needed by test_package-1.0.0-0.el6.x86_64

-V|--verify <packagefile>+

RPM 패키지 검증 명령어.

rpm -V or (--verify, or -y)
  • Package Selection Options
pkg1 … pkgN    Verify named package(s)
-p <file>      Verify against package file <file>
-f <file>      Verify package owning <file>
-a             Verify all installed packages
-g <group>     Verify packages belonging to group <group>
  • Verify-specific Options
--noscripts    Do not execute verification script
--nodeps       Do not verify dependencies
--nofiles      Do not verify file attributes
  • General Options
-v                 Display additional information
-vv                Display debugging information
--root <path>      Set alternate root to <path>
--rcfile <rcfile>  Set alternate rpmrc file to <rcfile>
--dbpath <path>    Use <path> to find the RPM database

See more