Recommanded Free YOUTUBE Lecture: <% selectedImage[1] %>

Contents

yum

redhat 계열 리눅스 운영체제의 패키지 관리 시스템이다. 자주 사용하긴 하는데, 매번 검색하기 귀찮아서 자주 사용하는 명령을 정리하려 한다.

패키지 찾기

패키지 이름, description, summary에 있는 일치하는 문자열이 있는지를 찾는다.
# yum search imap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
===================================== Matched: imap =====================================
cyrus-imapd.x86_64 : A high-performance mail server with IMAP, POP3, NNTP and SIEVE
                   : support
cyrus-imapd-devel.i386 : Cyrus IMAP server development files
cyrus-imapd-devel.x86_64 : Cyrus IMAP server development files
cyrus-imapd-perl.x86_64 : Cyrus IMAP server utility Perl modules
cyrus-imapd-utils.x86_64 : Cyrus IMAP server administration utilities
dovecot.x86_64 : Dovecot Secure imap server
fetchmail.x86_64 : A remote mail retrieval and forwarding utility.
imp-h3.noarch : The Internet Messaging Program: webmail access to IMAP/POP3 accounts.
...

yum provicesyum whatprovides의 alias다. 파일의 패키지 정보를 보여준다.
# yum provides /usr/bin/make
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
1:make-3.81-3.el5.x86_64 : A GNU tool which simplifies the build process for users.
Repo        : base
Matched from:
Filename    : /usr/bin/make

1:make-3.81-3.el5.x86_64 : A GNU tool which simplifies the build process for users.
Repo        : installed
Matched from:
Other       : Provides-match: /usr/bin/make

설치된 패키지 목록을 보여준다.
# yum list installed
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
Installed Packages
GConf2.x86_64                                2.14.0-9.el5                       installed
MAKEDEV.x86_64                               3.23-1.2                           installed
NetworkManager.i386                          1:0.7.0-9.el5                      installed
NetworkManager.x86_64                        1:0.7.0-9.el5                      installed
NetworkManager-glib.i386                     1:0.7.0-9.el5                      installed
NetworkManager-glib.x86_64                   1:0.7.0-9.el5                      installed
ORBit2.x86_64                                2.14.3-5.el5                       installed
SysVinit.x86_64                              2.86-15.el5                        installed
acl.x86_64                                   2.2.39-3.el5                       installed
acpid.x86_64                                 1.0.4-9.el5                        installed

설치할 수 있는 패키지 목록을 보여준다.
# yum list available
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
Available Packages
Cluster_Administration-as-IN.noarch        5.8-1.el5.centos              base   
Cluster_Administration-bn-IN.noarch        5.8-1.el5.centos              base   
Cluster_Administration-de-DE.noarch        5.8-1.el5.centos              base   
Cluster_Administration-en-US.noarch        5.8-1.el5.centos              base   
Cluster_Administration-es-ES.noarch        5.8-1.el5.centos              base   
...

업데이트 할 수 있는 패키지 목록
# yum list updates
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
Updated Packages
NetworkManager.i386                        1:0.7.0-13.el5                base   
NetworkManager.x86_64                      1:0.7.0-13.el5                base   
NetworkManager-glib.i386                   1:0.7.0-13.el5                base   
NetworkManager-glib.x86_64                 1:0.7.0-13.el5                base   
SysVinit.x86_64                            2.86-17.el5                   base   
...

패키지 설치

# yum install [package name] 

패키지 삭제

# yum erase package-name

패키지 정보

# yum info ruby
Loaded plugins: fastestmirror                                                                     
Loading mirror speeds from cached hostfile                                                        
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr
 * updates: centos.tt.co.kr
Installed Packages
Name       : ruby
Arch       : x86_64
Version    : 1.8.7.352
Release    : 5.el5
Size       : 1.1 M
Repo       : installed
Summary    : An interpreter of object-oriented scripting language
URL        : http://www.ruby-lang.org/
License    : Ruby or GPLv2
Description: Ruby is the interpreted scripting language for quick and easy
           : object-oriented programming.  It has many features to process text
           : files and to do system management tasks (as in Perl).  It is simple,
           : straight-forward, and extensible.

로컬 RPM 파일 설치

# yum localinstall package-name.rpm

저장소 관리

저장소 확인

# yum repolist
repo id          repo name                   status
base             CentOS-6 - Base             6,294
extras           CentOS-6 - Extras               4
updates          CentOS-6 - Updates            830
repolist: 7,128

EPEL 저장소 사용하기

EPEL(Extra Packages for Enterprise Linux)는 페도라 그룹에서 관리하는 저장소로 기업 환경에서 사용할 수 있는 높은 수준의 리눅스 패키지를 제공하기 위한 저장소다. CentOS와 Read hat enterprise linux에서 사용할 수 있다.

EPL 저장소는 http://www.thegeekstuff.com/2012/06/enable-epel-repository 에서 확인할 수 있다. CentOS6 혹은 CentOS5 버전에 맞는 rpm을 다운로드 받아서 저장소 정보에 추가하면 된다.
# rpm -ivh epel-release-6-8.noarch.rpm 
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]

저장소를 사용하기 위해서 GPG Key를 다운로드 받아서 등록한다.
# wget https://fedoraproject.org/static/0608B895.txt --no-check-certificate
# cp 0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 

Key가 성공적으로 등록됐는지 확인한다.
]# rpm -qa gpg*
gpg-pubkey-0608b895-4bd22942

Yum 저장소 목록을 확인해 보자.
 yum repolist
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirror.chpc.utah.edu
 * epel: ftp.iij.ad.jp
 * extras: mirror.pac-12.org
 * updates: mirror.veracruz.co
repo id            repo name                                      status
base               CentOS-6 - Base                                6,381
epel               Extra Packages for Enterprise Linux 6 - x86_64 8,766
extras             CentOS-6 - Extras                              12
rbel6              RBEL 6 Repo                                    183
updates            CentOS-6 - Updates                             647
repolist: 15,989