# APT(Advanced Package Tool)로 젠킨스 설치하기

* 1차 수정일 \[2020.01.19] - 작업 환경 명시

[APT(Advanced Packaging Tool)](https://wiki.debian.org/AptCLI)은 리눅스계열 OS에서 소프트웨어를 설치하고 제거하는 일을 한다. 이진파일이나 소스코드 컴파일을 통해서 패키지의 확인, 구성, 설치를 자동화하여 소프트웨어 관리작업을 단순하게 한다. ([출처](https://wiki.debian.org/ko/Apt) 참고) APT으로 젠킨스를 설치해보자.

> 작업 환경 : Ubuntu 18.04

#### 1. 패키지의 삭제 없이 버전을 모두 업그레이드

```
$ apt update
```

또는

```
$ apt upgrade
```

패키지의 재설치 또는 삭제를 요구하는 업그레이드를 실행하려면 `dist-upgrade`를 쓴다.

```
$ apt dist-upgrade
```

`dist-upgrade`를 실행한 뒤에 삭제된 패키지는 직접 재설치 해야한다.&#x20;

####

#### 2. JDK(Java Development Kit)를 검색해서 설치

```
$ apt search default-jdk 
$ apt install default-jdk
```

```
$ apt search default-jdk
Sorting... Done
Full Text Search... Done
default-jdk/bionic-updates,bionic-security 2:1.11-68ubuntu1~18.04.1 amd64
  Standard Java or Java compatible Development Kit

default-jdk-doc/bionic-updates,bionic-security 2:1.11-68ubuntu1~18.04.1 amd64
  Standard Java or Java compatible Development Kit (documentation)

default-jdk-headless/bionic-updates,bionic-security 2:1.11-68ubuntu1~18.04.1 amd64
  Standard Java or Java compatible Development Kit (headless)

$ apt install -y default-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:OpenTrust_Root_CA_G1.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
...
```

설치한 JDK버전은 `java --version`으로 확인 가능하다.

```
$ java -version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)
```

#### 3. `deb`파일로 젠킨스 설치

[pkg.jenkins.io/debian-stable](https://pkg.jenkins.io/debian-stable/) 에서 deb파일을 다운로드한다.

```
$ wget https://pkg.jenkins.io/debian-stable/binary/jenkins_2.204.1_all.deb
```

다운로드한 파일이 있는 디렉토리로 이동하여 설치를 실행한다. APT는 로컬에 다운로드한 debian 파일로도 패키지를 설치할 수 있다.

```
$ sudo apt install ./jenkins_2.204.1_all.deb
```

또는 dpkg로도 설치 가능하다.

```
$ dpkg -i jenkins_2.204.1_all.deb
```

만약 설치 도중에 아래와 같은 에러메세지와 함께 중단되면 `--fix-broken` 또는 `-f` 옵션으로 설치되지 않은 젠킨스의 의존성 패키지를 추가로 설치한다. 아래 메세지는 `dpkg`로 설치했을 때 발생한다. (When `dpkg` installs a package and a package dependency is not satisfied, it leaves the package in an "unconfigured" state and that package is considered broken. dpkg와 APT의 차이점은 [여기](https://askubuntu.com/questions/309113/what-is-the-difference-between-dpkg-and-aptitude-apt-get)를 참고.)

```
dpkg: dependency problems prevent configuration of jenkins:
 jenkins depends on daemon; however:
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 jenkins : Depends: daemon but it is not installed
```

```
$ apt install --fix-broken
```

설치가 완료되었으면 데몬이 정상적으로 실행되고 있는지 확인한다.

![](/files/-Lx_Y8TiO5xpwK8-x4iV)

출처

* [how to install deb file by dpkg or apt](https://unix.stackexchange.com/questions/159094/how-to-install-a-deb-file-by-dpkg-i-or-by-apt)
* [package management](https://wiki.debian.org/AptCLI?highlight=%28%5CbCategoryPackageManagement%5Cb%29)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kde6260.gitbook.io/dev/linux/apt-advanced-package-tool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
