Add-apt-repository
Adds a repository into the /etc/apt/sources.list
or /etc/apt/sources.list.d
or removes an existing one.
SYNOPSIS
Options
-
-h
,--help
- Show help message and exit
-
-m
,--massive-debug
- Print a lot of debug information to the command line
-
-r
,--remove
- Remove the specified repository
-
-y
,--yes
- Assume yes to all queries
-
-u
,--update
- After adding the repository, update the package cache with packages from this repository (avoids need to
apt-get update
)
-
-k
,--keyserver
- Use a custom keyserver URL instead of the default
-
-s
,--enable-source
- Allow downloading of the source packages from the repository
작동 방식
일반 저장소를 지정하면 /etc/apt/sources.list
에 저장된다.
PPA 형식(ppa:<user>/<ppa-name>
)은 PPA의 전체 deb 행으로 확장되고 /etc/apt/sources.list.d/
디렉토리에 새 파일이 추가된다. 새로 추가된 PPA의 GPG 공개 키도 다운로드되어 apt의 키링에 추가됩니다.
패키지 설치 방법
To be able to use add-apt-repository
you may need to install software-properties-common
:
export DEBIAN_FRONTEND=noninteractive # 필요하다면 ...
sudo apt update
sudo apt install software-properties-common
Manually update
수동으로 GPG Key를 추가하고 싶다면 PPA 저장소 사이트에서 아래와 같이 진입한다. (참조 사이트: How do I fix the GPG error “NO_PUBKEY”?)
URL을 복사한 후 아래와 같이 입력하면 된다.
$ curl -sS "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x8CF63AD3F06FC659" \
| sed -n -e '/BEGIN PGP PUBLIC KEY BLOCK/,$p' \
| sed -n -e '1,/END PGP PUBLIC KEY BLOCK/p' \
| sudo apt-key add -
이 후, 저장소 URL을 아래와 같이 추가해 주면 된다.
$ echo "deb http://ppa.launchpad.net/jonathonf/ffmpeg-4/ubuntu/ bionic main" | sudo tee /etc/apt/sources.list.d/jonathonf-ubuntu-ffmpeg-4-bionic.list
마지막으로 업데이트하면 된다.
PPA 추가 방법
다음과 같이 단축 방법으로 추가하면 된다.
Examples
-
apt-add-repository 'deb
http://myserver/path/to/repo
stable myrepo'
- 따옴표로 묶인 완전한 apt 줄
-
sudo apt-add-repository
http://extras.ubuntu.com/ubuntu
- 리포지토리 URL 및 따옴표로 묶은 영역 (기본값은 'main')
-
sudo apt-add-repository '
http://myserver/path/to/repo
myrepo'
-
sudo apt-add-repository '
https://packages.medibuntu.org
free non-free'
-
sudo add-apt-repository 'deb [arch=amd64]
https://repo.mongodb.org/apt/ubuntu
bionic/mongodb-org/4.0 multiverse'
- multiverse - 주어진 배포 구성 요소가 모든 소스에 대해 활성화됩니다.
-
sudo add-apt-repository --remove 'deb [arch=amd64]
https://repo.mongodb.org/apt/ubuntu
bionic/mongodb-org/4.0 multiverse'
- 추가된 저장소 제거
-
echo "deb
https://apache.bintray.com/couchdb-deb
$(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list
- 수동으로 추가하는 방법