본문 바로가기

Linux

Local Repository 만들기

Local Repository 만들기

 

[repository 폴더로 이동]
[root@station /]# ll /etc/yum.repos.d/
합계 28
-rw-r--r--. 1 root root 1664 4월 1 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 4월 1 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 4월 1 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1331 4월 1 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1002 4월 1 2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 290 4월 1 2015 CentOS-fasttrack.repo

 

[기존 repository 파일 압축]
[root@station /]# bzip2 /etc/yum.repos.d/CentOS-*.repo
[root@station /]# ll /etc/yum.repos.d/
합계 28
-rw-r--r--. 1 root root 648 4월 1 2015 CentOS-Base.repo.bz2
-rw-r--r--. 1 root root 774 4월 1 2015 CentOS-CR.repo.bz2
-rw-r--r--. 1 root root 441 4월 1 2015 CentOS-Debuginfo.repo.bz2
-rw-r--r--. 1 root root 597 4월 1 2015 CentOS-Sources.repo.bz2
-rw-r--r--. 1 root root 357 4월 1 2015 CentOS-Vault.repo.bz2
-rw-r--r--. 1 root root 238 4월 1 2015 CentOS-fasttrack.repo.bz2

 

[yum에서 repository 미인식 확인]
[root@station /]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repolist: 0

 

[local.repo 생성]
[root@station /]# vi /etc/yum.repos.d/local.repo
[local]
name=local.repo
baseurl=file:///mnt/packages
enabled=1
gpgcheck=0

 

[Install CD에 있는 Packages를 /mnt/packages로 이동]
[root@test Packages]# cp /run/media/root/CentOS7x86_64/Packages/* /mnt/packages

 

[createrepo 명령으로 Index 생성]
[root@test packages]# createrepo /mnt/packages/
Spawning worker 0 with 1788 pkgs
Spawning worker 1 with 1788 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

 

[yum clean all 명령으로 yum의 buffer 정리]
[root@test /]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: local
Cleaning up everything
Cleaning up list of fastest mirrors

 

[yum repolist 명령으로 local.repo 인식 확인]
[root@test packages]# yum repolist
Loaded plugins: fastestmirror, langpacks
local | 2.9 kB 00:00:00
local/primary_db | 2.7 MB 00:00:00
Determining fastest mirrors
repo id repo name status
local local.repo 3,576
repolist: 3,576

 

[yum makecache 명령으로 yum repository에 대한metadata 생성]
[root@test packages]# yum makecahe
Loaded plugins: fastestmirror, langpacks
No such command: makecahe. Please use /usr/bin/yum --help
[root@test packages]# yum makecache
Loaded plugins: fastestmirror, langpacks
local | 2.9 kB 00:00:00
(1/2): local/filelists_db | 2.7 MB 00:00:00
(2/2): local/other_db | 1.1 MB 00:00:00
Loading mirror speeds from cached hostfile
Metadata Cache Created

 

[vsftpd 패키지 설치 테스트]
[root@test packages]# yum install -y vsftpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-9.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================
Package Arch Version Repository Size
==========================================================================
Installing:
vsftpd x86_64 3.0.2-9.el7 local 165 k
Transaction Summary
==========================================================================
Install 1 Package
Total download size: 165 k
Installed size: 343 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : vsftpd-3.0.2-9.el7.x86_64 1/1
Verifying : vsftpd-3.0.2-9.el7.x86_64 1/1
Installed:
vsftpd.x86_64 0:3.0.2-9.el7


Complete!