차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
| pve9_local_repository_구성 [2025/11/21 00:39] – [참조링크] koov | pve9_local_repository_구성 [2025/11/21 03:02] (현재) – koov | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| ====== PVE9 local repository 구성 ====== | ====== PVE9 local repository 구성 ====== | ||
| + | --- // | ||
| 인터넷이 안되는 환경이나 특수한 상황에서 PVE를 구성해야 할 경우 레포지토리를 접근하기 위해 로컬에 레포지토리 미러를 구성하는 방법에 대해 설명한다. | 인터넷이 안되는 환경이나 특수한 상황에서 PVE를 구성해야 할 경우 레포지토리를 접근하기 위해 로컬에 레포지토리 미러를 구성하는 방법에 대해 설명한다. | ||
| 줄 26: | 줄 27: | ||
| Existing config entries: | Existing config entries: | ||
| mirror ' | mirror ' | ||
| + | mirror ' | ||
| mirror ' | mirror ' | ||
| mirror ' | mirror ' | ||
| 줄 41: | 줄 43: | ||
| '' | '' | ||
| * '' | * '' | ||
| + | * '' | ||
| * '' | * '' | ||
| * '' | * '' | ||
| 줄 46: | 줄 49: | ||
| * '' | * '' | ||
| - | 위의 | + | 미러링 설정한 내용을 조회하려면 아래와 같다. |
| + | |||
| + | <WRAP prewrap> | ||
| + | <code bash> | ||
| + | root@pve:/ | ||
| + | ┌────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────┬────────┬──────┐ | ||
| + | │ ID │ repository | ||
| + | ╞════════════════════════════╪═══════════════════════════════════════════════════════════════════════════════════════════════════╪═══════════════════════════════════════╪════════╪══════╡ | ||
| + | │ ceph_squid_trixie | ||
| + | ├────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────┼────────┼──────┤ | ||
| + | │ debian_trixie_backports | ||
| + | ├────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────┼────────┼──────┤ | ||
| + | │ debian_trixie_main | ||
| + | ├────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────┼────────┼──────┤ | ||
| + | │ debian_trixie_security | ||
| + | ├────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────┼────────┼──────┤ | ||
| + | │ debian_trixie_updates | ||
| + | ├────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────┼────────┼──────┤ | ||
| + | │ pve_trixie_no-subscription │ deb http:// | ||
| + | └────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────┴────────┴──────┘ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 혹시 미러링 경로나 대상 디렉토리를 변경하려면 아래와 같이 수행하면 된다. | ||
| + | <WRAP prewrap> | ||
| + | <code bash> | ||
| + | proxmox-offline-mirror config mirror update --id debian_trixie_backports --repository "deb http:// | ||
| + | proxmox-offline-mirror config mirror update --id debian_trixie_main --repository "deb http:// | ||
| + | proxmox-offline-mirror config mirror update --id debian_trixie_updates --repository "deb http:// | ||
| + | proxmox-offline-mirror config mirror update --id debian_trixie_security --repository "deb http:// | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | 위의 | ||
| <WRAP prewrap> | <WRAP prewrap> | ||
| 줄 71: | 줄 109: | ||
| debian_trixie_security | debian_trixie_security | ||
| debian_trixie_updates | debian_trixie_updates | ||
| + | debian_trixie_backports | ||
| ) | ) | ||
| + | BASE_DIR="/ | ||
| # 각 미러에 대해 스냅샷 생성 | # 각 미러에 대해 스냅샷 생성 | ||
| for MIRROR in " | for MIRROR in " | ||
| + | if [ ! -d " | ||
| + | echo "Dir not exists : $MIRROR creating..." | ||
| + | mkdir -p " | ||
| + | fi | ||
| + | |||
| echo " | echo " | ||
| proxmox-offline-mirror mirror snapshot create " | proxmox-offline-mirror mirror snapshot create " | ||
| 줄 84: | 줄 129: | ||
| done | done | ||
| - | # 가비지 컬렉션 실행 | + | # 가비지 컬렉션 실행 |
| echo " | echo " | ||
| proxmox-offline-mirror mirror gc | proxmox-offline-mirror mirror gc | ||
| 줄 93: | 줄 138: | ||
| 미러링을 시작하면 한번에 완료되는것이 아니라 네트워크 상태나 레포지토리 서버의 상태에 따라 중간에 실패하거나 끊기는 경우가 있다. 그럴경우 스크립트를 다시 재실행하면 된다. 물론 스냅샷은 실행할때마다 생성되겠지만 어차피 패키지 파일은 동일한 파일이 있는경우 생략하기 때문에 상관이 없다. | 미러링을 시작하면 한번에 완료되는것이 아니라 네트워크 상태나 레포지토리 서버의 상태에 따라 중간에 실패하거나 끊기는 경우가 있다. 그럴경우 스크립트를 다시 재실행하면 된다. 물론 스냅샷은 실행할때마다 생성되겠지만 어차피 패키지 파일은 동일한 파일이 있는경우 생략하기 때문에 상관이 없다. | ||
| - | 2025-10-16일 현재 모든 레포지토리의 동기화 후 용량은 대략 아래와 같다. | + | 2025-11-21일 현재 모든 레포지토리의 동기화 후 용량은 대략 아래와 같다. |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| + | * '' | ||
| ===== 레포지토리 구성 ===== | ===== 레포지토리 구성 ===== | ||
| 줄 106: | 줄 152: | ||
| <WRAP prewrap> | <WRAP prewrap> | ||
| <code bash> | <code bash> | ||
| - | proxmox-repo:~# cd /var/lib/proxmox-offline-mirror/ | + | root@pve:/data# cd proxmox-offline-mirror/ |
| - | proxmox-repo:/var/lib/ | + | root@pve:/data/ |
| - | total 32 | + | total 4 |
| - | drwxr-xr-x | + | drwxr-xr-x |
| - | drwxr-xr-x 3 root root 4096 Oct 16 10:30 ../ | + | drwxr-xr-x 3 root root 21 Nov 20 23:08 ../ |
| - | drwxr-xr-x | + | drwxr-xr-x |
| - | drwxr-xr-x | + | drwxr-xr-x |
| - | drwxr-xr-x | + | drwxr-xr-x 3 root root 34 Nov 21 10:52 debian_trixie_main/ |
| - | drwxr-xr-x | + | drwxr-xr-x |
| - | drwxr-xr-x 4 root root 4096 Oct 16 10:31 .pool/ | + | drwxr-xr-x |
| - | drwxr-xr-x | + | drwxr-xr-x 4 root root 47 Nov 20 23:11 .pool/ |
| - | proxmox-repo:/var/lib/ | + | drwxr-xr-x |
| + | root@pve:/data/ | ||
| . | . | ||
| ├── ceph_squid_trixie | ├── ceph_squid_trixie | ||
| 줄 198: | 줄 245: | ||
| 위와같이 미러링을 시도할때마다 스냅샷이 날짜시간 형태로 계속해서 만들어진다. 그렇다고 해서 동일한 패키지 파일을 계속 받아두는 방식은 아니고 '' | 위와같이 미러링을 시도할때마다 스냅샷이 날짜시간 형태로 계속해서 만들어진다. 그렇다고 해서 동일한 패키지 파일을 계속 받아두는 방식은 아니고 '' | ||
| + | |||
| + | '' | ||
| + | |||
| + | 만약 스냅샷을 모두 삭제하고 싶다면 아래 스크립트를 이용하도록 한다. | ||
| + | '' | ||
| + | <WRAP prewrap> | ||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | MIRRORS=( | ||
| + | pve_trixie_no-subscription | ||
| + | ceph_squid_trixie | ||
| + | debian_trixie_main | ||
| + | debian_trixie_security | ||
| + | debian_trixie_updates | ||
| + | debian_trixie_backports | ||
| + | ) | ||
| + | |||
| + | # 각 미러에 대해 모든 스냅샷 제거 | ||
| + | for MIRROR in " | ||
| + | echo " | ||
| + | |||
| + | proxmox-offline-mirror mirror snapshot list $MIRROR --output-format json | jq -r " | ||
| + | echo " | ||
| + | proxmox-offline-mirror mirror snapshot remove $MIRROR " | ||
| + | done | ||
| + | done | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <WRAP center round important 60%> | ||
| + | 실행후 반드시 다시한번 미러링을 실시하여 스냅샷을 최소 한개 만들어놔야지만 '' | ||
| + | </ | ||
| 이렇게 미러는 구성되어 있지만 우리는 일반적인 레포지토리 형태로 사용하고 싶기 때문에 아래 스크립트를 이용하여 레포지토리를 복제하도록 한다. | 이렇게 미러는 구성되어 있지만 우리는 일반적인 레포지토리 형태로 사용하고 싶기 때문에 아래 스크립트를 이용하여 레포지토리를 복제하도록 한다. | ||
| 줄 205: | 줄 284: | ||
| <code bash> | <code bash> | ||
| #!/bin/bash | #!/bin/bash | ||
| - | MIRROR_BASE=/ | + | MIRROR_BASE=/data/repo |
| - | ORIG_BASE=/var/lib/ | + | ORIG_BASE=/data/ |
| - | for MIRROR in ceph_squid_trixie debian_trixie_main debian_trixie_security debian_trixie_updates pve_trixie_no-subscription; | + | |
| + | # directory check | ||
| + | if [ ! -d " | ||
| + | echo "Dir not exists : $MIRROR_BASE creating..." | ||
| + | mkdir -p " | ||
| + | fi | ||
| + | |||
| + | for MIRROR in ceph_squid_trixie debian_trixie_main debian_trixie_security debian_trixie_updates | ||
| LATEST=$(ls -d $ORIG_BASE/ | LATEST=$(ls -d $ORIG_BASE/ | ||
| echo " | echo " | ||
| 줄 275: | 줄 361: | ||
| ##### | ##### | ||
| Types: deb | Types: deb | ||
| - | URIs: file:/// | + | URIs: file:///data/ |
| Suites: trixie | Suites: trixie | ||
| Components: no-subscription | Components: no-subscription | ||
| 줄 281: | 줄 367: | ||
| Types: deb | Types: deb | ||
| - | URIs: file:/// | + | URIs: file:/// |
| + | Suites: trixie-backports | ||
| + | Components: main contrib non-free non-free-firmware | ||
| + | Trusted: yes | ||
| + | |||
| + | Types: deb | ||
| + | URIs: file:/// | ||
| Suites: trixie | Suites: trixie | ||
| - | Components: main contrib | + | Components: main contrib |
| Trusted: yes | Trusted: yes | ||
| Types: deb | Types: deb | ||
| - | URIs: file:/// | + | URIs: file:///data/ |
| Suites: trixie-security | Suites: trixie-security | ||
| - | Components: main | + | Components: main contrib non-free non-free-firmware |
| Trusted: yes | Trusted: yes | ||
| Types: deb | Types: deb | ||
| - | URIs: file:/// | + | URIs: file:///data/ |
| Suites: trixie-updates | Suites: trixie-updates | ||
| - | Components: main | + | Components: main contrib non-free non-free-firmware |
| Trusted: yes | Trusted: yes | ||
| Types: deb | Types: deb | ||
| - | URIs: file:/// | + | URIs: file:///data/ |
| Suites: trixie | Suites: trixie | ||
| Components: pve-no-subscription | Components: pve-no-subscription | ||
| Trusted: yes | Trusted: yes | ||
| + | |||
| </ | </ | ||
| </ | </ | ||
| 줄 314: | 줄 407: | ||
| ##### | ##### | ||
| deb [trusted=yes] file:/// | deb [trusted=yes] file:/// | ||
| - | deb [trusted=yes] file:/// | + | deb [trusted=yes] file:/// |
| - | deb [trusted=yes] file:/// | + | deb [trusted=yes] file:/// |
| - | deb [trusted=yes] file:/// | + | deb [trusted=yes] file:/// |
| + | deb [trusted=yes] file:/// | ||
| deb [trusted=yes] file:/// | deb [trusted=yes] file:/// | ||
| </ | </ | ||