IT/Redhat

YUM 설정 - 로컬ISO이미지 활용

xw10dsm 2015. 9. 2. 10:12

0. 로컬파일시스템에 iso 이미지가 존재하는 상태에서의 yum 구성



1) iso 이미지 
iso 파일 위치 : /YUM/rhel6.4.iso


3) iso 이미지 자동 mount

mkdir /mnt/iso
mkdir /root/works

[root@linuxagent01 YUM]# cd /mnt
[root@linuxagent01 mnt]# ls
hgfs  iso
[root@linuxagent01 mnt]# cd
[root@linuxagent01 ~]# pwd
/root
[root@linuxagent01 ~]# cd works

vi mount_iso.sh
아래의 정보를 입력한다.
mount -o loop -t iso9660 -r /YUM/rhel6.4.iso /mnt/iso

chmod 755 mount_iso.sh

- Crontab에 부팅시 자동으로 mount 되도록 등록
@reboot /root/works/mount_iso.sh


3) repo 설정하기

[root@linuxagent01 ~]# cd /etc/yum.repos.d/
[root@linuxagent01 yum.repos.d]# ls
rhel-source.repo
[root@linuxagent01 yum.repos.d]# cp rhel-source.repo iso.repo
[root@linuxagent01 yum.repos.d]#




[root@linuxagent01 yum.repos.d]# vi iso.repo
아래의 정보로 수정한다.

(redhat인 경우)
[iso]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/iso/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

(centos인 경우)
[iso]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/iso
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release



4) yum 확인하기

-리부팅후 iso 파일이 정상적으로 mount 되는지 확인
[root@linuxagent01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rhel64base-lv_root
                       45G  8.7G   34G  21% /
tmpfs                1000M  224K 1000M   1% /dev/shm
/dev/sda1             485M   38M  422M   9% /boot
/YUM/rhel6.4.iso      3.5G  3.5G     0 100% /mnt/iso
[root@linuxagent01 ~]#

- yum install ksh(기타 패키지) 명령어로 정상 설치여부 확인

[root@linuxagent01 ~]# yum install ksh
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ksh.x86_64 0:20100621-19.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================
Package                              Arch                                    Version
=========================================================================================================================
Installing:
ksh                                  x86_64                                  20100621-19.el6

Transaction Summary
=========================================================================================================================
Install       1 Package(s)

Total download size: 686 k
Installed size: 1.5 M
Is this ok [y/N]: N
Exiting on user Command
[root@linuxagent01 ~]# yum install ksh
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ksh.x86_64 0:20100621-19.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================
Package                 Arch                       Version                                Repository               Size
=========================================================================================================================
Installing:
ksh                     x86_64                     20100621-19.el6                        iso                     686 k

Transaction Summary
=========================================================================================================================
Install       1 Package(s)

Total download size: 686 k
Installed size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0xFD431D51:
Userid : Red Hat, Inc. (release key 2) <security@redhat.com>
Package: redhat-release-server-6Server-6.4.0.4.el6.x86_64 (@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4)
From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Importing GPG key 0x2FA658E0:
Userid : Red Hat, Inc. (auxiliary key) <security@redhat.com>
Package: redhat-release-server-6Server-6.4.0.4.el6.x86_64 (@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4)
From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ksh-20100621-19.el6.x86_64                                                                            1/1
iso/productid                                                                                     | 1.7 kB     00:00 ...
  Verifying  : ksh-20100621-19.el6.x86_64                                                                            1/1

Installed:
  ksh.x86_64 0:20100621-19.el6

Complete!
[root@linuxagent01 ~]#