사용자 도구

사이트 도구


linux:apt

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
linux:apt [2022/07/20 09:27]
kwon37xi [apt-key]
linux:apt [2025/05/14 16:57] (현재)
kwon37xi [ansible 의 경우]
줄 7: 줄 7:
   * [[linux:aptitude|aptitude]]   * [[linux:aptitude|aptitude]]
   * [[linux:nala|nala]]   * [[linux:nala|nala]]
 +  * [[linux:debian:makedeb_mpm|makedeb / mpm]]
  
 ===== 설치 ===== ===== 설치 =====
줄 118: 줄 119:
 man apt-key 8 man apt-key 8
 </code> </code>
-  * ''apt-key'' 명령은 deprecated 상태라고 보면 된다. 아래와 같은 명령을 사용한다면 후자로 변경해줘야 한다.+  * ''apt-key'' 명령은 **deprecated** 되었으며 [[linux:ubuntu:25.04|Ubuntu 25.04]]에서는 아예 삭제되었다. 아래와 같은 명령을 사용한다면 후자로 변경해줘야 한다. 
 +  * [[devops:ansible|Ansible]] 에서 ''apt-key''도 사용하지 말 것. 
 + 
 +==== script의 경우 ==== 
 <code sh> <code sh>
 +# 사용 금지
 wget -qO- https://myrepo.example/myrepo.asc | sudo apt-key add - wget -qO- https://myrepo.example/myrepo.asc | sudo apt-key add -
 +
 +# 이렇게 사용. 
 wget -qO- https://myrepo.example/myrepo.asc | sudo tee /etc/apt/trusted.gpg.d/myrepo.asc wget -qO- https://myrepo.example/myrepo.asc | sudo tee /etc/apt/trusted.gpg.d/myrepo.asc
 </code> </code>
   * 명시적 ''signed-by'' 키의 경우 **''/etc/apt/keyrings/''** 아래에 저장하고 repository source 파일에 ''deb [signed-by=/usr/share/keyrings/filename.gpg] ...'' 처럼 지정해준다.   * 명시적 ''signed-by'' 키의 경우 **''/etc/apt/keyrings/''** 아래에 저장하고 repository source 파일에 ''deb [signed-by=/usr/share/keyrings/filename.gpg] ...'' 처럼 지정해준다.
-  * ASCII armored 파일의 경우 파일 확장자가 ''.asc'' 여야 한다. +  * ASCII armored 파일의 경우 파일 확장자가 **''.asc''** 여야 한다. 
-  * Open PGP 바이너리의 경우(''%%gpg --dearmor%%'' 로 저장했거나) ''.gpg'' 확장자로 저장해야 한다.+  * Open PGP 바이너리의 경우(''%%gpg --dearmor%%'' 로 저장했거나) **''.gpg''** 확장자로 저장해야 한다.
  
 +==== ansible 의 경우 ====
 +  * [[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/deb822_repository_module.html|ansible.builtin.deb822_repository module – Add and remove deb822 formatted repositories — Ansible Community Documentation]]
 +    * Repository 추가와 key 추가를 함께 동시에 한다.
 +  * [[https://gist.github.com/roib20/27fde10af195cee1c1f8ac5f68be7e9b|Example usages of the new `deb822_repository` Ansible module · GitHub]]
 +
 +<code yaml>
 +- name: Add repo using key from URL
 +  deb822_repository:
 +    name: example
 +    types: deb
 +    uris: https://download.example.com/linux/ubuntu
 +    suites: '{{ ansible_distribution_release }}'
 +    components: stable
 +    architectures: amd64
 +    signed_by: https://download.example.com/linux/ubuntu/gpg
 +</code>
 +  * https://gist.github.com/roib20/27fde10af195cee1c1f8ac5f68be7e9b : 각종 deb 패키지 리포지토리 예시
 ===== CheatSheet ===== ===== CheatSheet =====
   * [[http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html|Debian Linux apt-get package management cheat sheet]]   * [[http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html|Debian Linux apt-get package management cheat sheet]]
줄 139: 줄 164:
 ===== 가장 빠른 미러 찾기 ===== ===== 가장 빠른 미러 찾기 =====
   * [[https://linuxconfig.org/how-to-select-the-fastest-apt-mirror-on-ubuntu-linux|How to select the fastest apt mirror on Ubuntu Linux - Linux Tutorials - Learn Linux Configuration]]   * [[https://linuxconfig.org/how-to-select-the-fastest-apt-mirror-on-ubuntu-linux|How to select the fastest apt mirror on Ubuntu Linux - Linux Tutorials - Learn Linux Configuration]]
 +
 +===== 다음 패키지를 과거 버전으로 유지합니다:  =====
 +  * ''The following packages have been kept back:''
 +  * 설치돼 있는 패키지의 의존성에 어떤 변경이 발생해서 제대로 변경된 의존성을 설치하고 다른 것은 제거 하는 등의 작업이 일어날 때 발생하는 오류.
 +  * [[https://askubuntu.com/|apt - "The following packages have been kept back:" Why and how do I solve it? - Ask Ubuntu]]
 +
 +==== 신규 패키지와 함께 업그레이드 ====
 +  * 신규 설치 패키지를 보여주며 업그레이드한다. 그런데 지워야 할 패키지가 있을 경우에는 작동하지 않는 듯 하다.
 +<code sh>
 +sudo apt-get --with-new-pkgs upgrade
 +
 +</code>
 +
 +==== 명시적 install ====
 +  * upgrade 가 안되는 패키지를 명확하게 다시 ''apt install <package>'' 로 설치명령을 내리면 어떤 패키지의존성이 변경되었고 무엇을 더 설치하고 무엇을 지우는지 등이 나온다. 이를 확인하고서 설치 여부를 결정하면 된다.
 +
 +<code sh>
 +sudo apt install package1 package2 ...
 +
 +다음의 추가 패키지가 설치될 것입니다 :
 +  <어쩌구 저쩌구>
 +다음 패키지를 지울 것입니다:
 +  <어쩌구 저쩌구>
 +계속 하시겠습니까? [Y/n] <-- 선택하면 됨.
 +</code>
 +
 +==== 강제 업그레이드 ====
 +  * 신규 의존성을 모두 강제로 업그레이드한다.
 +  * 다소 위험할 수도 있다.
 +<code sh>
 +sudo apt dist-upgrade
 +</code>
  
 ===== 참조 ===== ===== 참조 =====
linux/apt.1658276830.txt.gz · 마지막으로 수정됨: 2022/07/20 09:27 저자 kwon37xi