Local Repository 구축

Seung·2022년 2월 13일
0

1. local repo에 사용할 패키지 가져오기
2. create repo
3. 안쓰는 repo disable
4. local repo를 이용해서 package 설치하기


1. local repo에 사용할 패키지 가져오기

  • 현재위치
[root@localhost ~]# pwd
/root
  • 현재 위치에 레포로 사용할 파일 가져오기
    centos@192.168.10.:/home/centos/files-repo에 있는 디렉터리를 현재 위치로 가져온다.
scp -r centos@192.168.10.:/home/centos/files-repo ./files_repo
[root@localhost ~]# ls -l
total 8
-rw-------. 1 root root 1347  28 23:24 anaconda-ks.cfg
drwxr-xr-x. 3 root root 4096  213 03:48 files_repo

2. create repo

cd ~/files_repo
dnf install createrepo -y # creatrepo가 없다면 
createrepo ./
export LOCAL_REPO_PATH=$PWD
dnf config-manager --add-repo file://${LOCAL_REPO_PATH}
dnf repolist
[root@localhost files_repo]# yum repolist
repo id                      repo name
AppStream                    CentOS-8 - AppStream
BaseOS                       CentOS-8 - Base
extras                       CentOS-8 - Extras
root_files_repo              created by dnf config-manager from file:///root/files_repo

3. 안쓰는 repo disable

local repo만 사용할 것이므로 다른 repository들은 disable 상태로 변경시켜준다.

$ dnf config-manager --set-disabled <repo-id>
[root@localhost files_repo]# yum repolist
repo id                      repo name
root_files_repo              created by dnf config-manager from file:///root/files_repo
  

4. local repo를 이용해서 package 설치하기

이제 files_repo 안에 있는 패키지중 하나를 아무거나 골라서 설치한다.


[root@localhost files_repo]# dnf install sshpass-1.06-9.el8.x86_64 -y
created by dnf config-manager from file:///root/files_repo           3.0 MB/s | 3.0 kB     00:00    
Dependencies resolved.
=====================================================================================================
 Package              Architecture        Version                 Repository                    Size
=====================================================================================================
Installing:
 sshpass              x86_64              1.06-9.el8              root_files_repo               27 k

Transaction Summary
=====================================================================================================
Install  1 Package

Total size: 27 k
Installed size: 40 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                             1/1 
  Installing       : sshpass-1.06-9.el8.x86_64                                                   1/1 
  Running scriptlet: sshpass-1.06-9.el8.x86_64                                                   1/1 
  Verifying        : sshpass-1.06-9.el8.x86_64                                                   1/1 

Installed:
  sshpass-1.06-9.el8.x86_64                                                                          

Complete!

참고 - Error: GPG check FAILED

만약 gpg check 에러가 발생한다면 gpgcheck를 하지않음으로 설정

echo "gpgcheck=0" >> /etc/yum.repos.d/root_files_repo.repo
profile
인프라 마스터가 되고 싶어요

0개의 댓글