단계별 젠킨스 설치 안내
이 글에서는 윈도우, 우분투, 그리고 CentOS 운영체제에 젠킨스를 설치하는 방법을 상세히 안내합니다.
젠킨스 설치 과정은 각 운영체제마다 약간씩 차이가 있지만, 설정 단계는 동일하게 진행됩니다.
젠킨스란 무엇인가?
젠킨스는 개발자들이 프로젝트와 애플리케이션을 자동화하여 빌드할 수 있도록 돕는 오픈 소스 도구입니다. 젠킨스는 소프트웨어 및 애플리케이션의 구축 및 배포를 자동화하는 데 활용됩니다. 작업 환경에 상관없이 지속적인 통합 및 배포를 가능하게 하는 강력한 자동화 도구입니다.
젠킨스는 자바 애플리케이션으로, Java Runtime Environment (JRE)가 설치된 모든 시스템에서 독립적으로 실행될 수 있습니다.
젠킨스에 대한 더 깊은 이해를 원하시면, 다음 온라인 강좌를 통해 젠킨스 전문가로 거듭나세요.
필수 조건
모든 운영체제에서 JDK 8 이상 버전이 설치되어 있어야 합니다. 먼저 JDK 8 이상 버전을 설치해야 합니다. 다음 링크에서 다운로드하여 설치할 수 있습니다. 여기
윈도우에 젠킨스 설치하기
JDK가 성공적으로 설치 및 실행되었다면, 이제 젠킨스를 다운로드하여 설치할 준비가 완료되었습니다. 여기를 클릭하여 윈도우용 최신 젠킨스 MSI 패키지를 다운로드하세요.
- 다운로드한 jenkins.msi 파일을 더블 클릭하여 설치를 시작합니다.
- ‘다음’을 클릭하여 설치를 진행합니다.
- 설치 경로를 변경하려면 ‘변경’ 버튼을 클릭하세요. 이 예시에서는 기본 설정을 유지하고 ‘다음’을 클릭합니다.
- 설치 과정이 완료되면 ‘마침’ 버튼을 클릭하여 설치를 완료합니다.
보시다시피, 윈도우에서 젠킨스 설치는 다른 표준 소프트웨어 설치와 마찬가지로 매우 간단합니다.
우분투에 젠킨스 설치하기
우분투 시스템에도 JDK 8 이상 버전이 설치 및 실행 중인지 확인해야 합니다. 만약 설치되어 있지 않다면, 다음 명령어를 사용하여 설치하십시오.
sudo apt install default-jdk-headless
[email protected]:~$ sudo apt install default-jdk-headless Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: default-jdk-headless 0 upgraded, 1 newly installed, 0 to remove and 102 not upgraded. Need to get 1132 B of archives. After this operation, 6144 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 default-jdk-headless amd64 2:1.11-68ubuntu1~18.04.1 [1132 B] Fetched 1132 B in 2s (676 B/s) Selecting previously unselected package default-jdk-headless. (Reading database ... 30061 files and directories currently installed.) Preparing to unpack .../default-jdk-headless_2%3a1.11-68ubuntu1~18.04.1_amd64.deb ... Unpacking default-jdk-headless (2:1.11-68ubuntu1~18.04.1) ... Setting up default-jdk-headless (2:1.11-68ubuntu1~18.04.1) ... [email protected]:~$
자바가 성공적으로 설치되었는지 확인하려면 다음 명령어를 실행하세요.
java -version
[email protected]:~$ java -version openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04) OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing) [email protected]:~$
설치가 완료되면, 이제 젠킨스 설치를 진행합니다.
설치 단계
1단계: 먼저 명령 터미널을 엽니다 (Ctrl + Alt + T).
2단계: 젠킨스 설치를 위해 시스템에 저장소 키를 추가합니다.
wget -q -O – http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add –
[email protected]:~$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - OK [email protected]:~$
3단계: 키 추가가 완료되면, 시스템에 데비안 패키지 저장소 주소를 추가해야 합니다.
sudo sh -c ‘echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’
4단계: 이제 우분투 패키지를 업데이트합니다.
sudo apt update
[email protected]:~$ sudo apt update Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Ign:3 http://pkg.jenkins-ci.org/debian-stable binary/ InRelease Get:4 http://pkg.jenkins-ci.org/debian-stable binary/ Release [2044 B] Get:5 http://pkg.jenkins-ci.org/debian-stable binary/ Release.gpg [195 B] Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Get:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB] Get:8 http://pkg.jenkins-ci.org/debian-stable binary/ Packages [17.6 kB] Get:9 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Get:10 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [748 kB] Get:11 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [237 kB] Get:12 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [50.8 kB] Get:13 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [12.3 kB] Get:14 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [673 kB] Get:15 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [223 kB] Get:16 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [7808 B] Get:17 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2856 B] Get:18 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB] Get:19 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB] Get:20 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB] Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [969 kB] Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [329 kB] Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [60.5 kB] Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [14.7 kB] Get:25 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1085 kB] Get:26 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [337 kB] Get:27 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [15.9 kB] Get:28 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [6420 B] Get:29 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [7516 B] Get:30 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [4764 B] Get:31 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [7484 B] Get:32 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [4436 B] Fetched 18.8 MB in 58s (327 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 102 packages can be upgraded. Run 'apt list --upgradable' to see them. [email protected]:~$
5단계: 마지막으로 젠킨스를 설치하려면 다음 명령어를 실행합니다.
sudo apt install jenkins
[email protected]:~$ sudo apt install jenkins Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: daemon The following NEW packages will be installed: daemon jenkins 0 upgraded, 2 newly installed, 0 to remove and 102 not upgraded. Need to get 65.7 MB of archives. After this operation, 66.8 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 daemon amd64 0.6.4-1build1 [99.5 kB] Get:2 http://pkg.jenkins-ci.org/debian-stable binary/ jenkins 2.235.1 [65.6 MB] Fetched 65.7 MB in 3min 34s (307 kB/s) Selecting previously unselected package daemon. (Reading database ... 29242 files and directories currently installed.) Preparing to unpack .../daemon_0.6.4-1build1_amd64.deb ... Unpacking daemon (0.6.4-1build1) ... Selecting previously unselected package jenkins. Preparing to unpack .../jenkins_2.235.1_all.deb ... Unpacking jenkins (2.235.1) ... Setting up daemon (0.6.4-1build1) ... Setting up jenkins (2.235.1) ... invoke-rc.d: could not determine current runlevel Processing triggers for systemd (237-3ubuntu10.39) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21) ... [email protected]:~$
젠킨스가 성공적으로 설치되었습니다. 이제 젠킨스 서버를 시작할 수 있습니다.
6단계: systemctl 명령어를 사용하여 젠킨스를 시작합니다.
sudo systemctl start jenkins
systemctl 명령어는 출력을 표시하지 않으므로, 다음 명령어를 사용하여 상태를 확인할 수 있습니다. 이 명령어를 통해 젠킨스가 활성화되었는지 확인할 수 있습니다.
sudo systemctl status jenkins
[email protected]:~$ sudo systemctl status jenkins ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; generated) Active: active (exited) since Sat 2020-04-04 10:10:19 UTC; 2 months 16 days ago Docs: man:systemd-sysv-generator(8) Tasks: 0 (limit: 4915) CGroup: /system.slice/jenkins.service Apr 04 10:10:18 ip-172-31-17-25 systemd[1]: Starting LSB: Start Jenkins at boot time... Apr 04 10:10:18 ip-172-31-17-25 jenkins[1984]: Correct java version found Apr 04 10:10:18 ip-172-31-17-25 jenkins[1984]: * Starting Jenkins Automation Server jenkins Apr 04 10:10:18 ip-172-31-17-25 su[2037]: Successful su for root by root Apr 04 10:10:18 ip-172-31-17-25 su[2037]: + ??? root:root Apr 04 10:10:18 ip-172-31-17-25 su[2037]: pam_unix(su:session): session opened for user root by (uid=0) Apr 04 10:10:18 ip-172-31-17-25 jenkins[1984]: mesg: ttyname failed: Inappropriate ioctl for device Apr 04 10:10:18 ip-172-31-17-25 su[2037]: pam_unix(su:session): session closed for user root Apr 04 10:10:19 ip-172-31-17-25 jenkins[1984]: ...done. Apr 04 10:10:19 ip-172-31-17-25 systemd[1]: Started LSB: Start Jenkins at boot time. [email protected]:~$
6단계: 포트 구성 (선택 사항)
기본적으로 젠킨스는 8080 포트에서 실행되며, 필요한 경우 어디서든 접근할 수 있도록 설정해야 합니다.
포트를 개방하려면:
sudo ufw allow 8080
다음 명령어로 포트 상태를 확인할 수 있습니다.
sudo ufw status
[email protected]:~$ sudo ufw status Status: active To Action From -- ------ ---- 8080 ALLOW Anywhere 8080 (v6) ALLOW Anywhere (v6) [email protected]:~$
방화벽이 비활성화되어 있다면 다음 명령어를 실행하세요. 그렇지 않으면 이 과정은 필요하지 않습니다.
sudo ufw allow OpenSSH
그런 다음
sudo ufw enable
CentOS에 젠킨스 설치하기
먼저 JDK 8 이상 버전이 컴퓨터에 설치 및 실행 중인지 확인합니다. 만약 설치되어 있지 않다면, 다음 명령어를 사용하여 OpenJDK 8 패키지를 설치합니다.
sudo yum install java-1.8.0-openjdk-devel
[[email protected] ~]$ sudo yum install java-1.8.0-openjdk-devel CentOS-8 - AppStream 1.0 kB/s | 4.3 kB 00:04 CentOS-8 - AppStream 397 kB/s | 5.8 MB 00:14 CentOS-8 - Base 3.5 kB/s | 3.9 kB 00:01 CentOS-8 - Extras 547 B/s | 1.5 kB 00:02 Jenkins-stable 6.5 kB/s | 2.9 kB 00:00 Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: java-1.8.0-openjdk-devel x86_64 1:1.8.0.252.b09-3.el8_2 AppStream 9.8 M Transaction Summary ================================================================================ Install 1 Package Total download size: 9.8 M Installed size: 41 M Is this ok [y/N]: y Downloading Packages: java-1.8.0-openjdk-devel-1.8.0.252.b09-3.el8_2. 531 kB/s | 9.8 MB 00:18 -------------------------------------------------------------------------------- Total 507 kB/s | 9.8 MB 00:19 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : java-1.8.0-openjdk-devel-1:1.8.0.252.b09-3.el8_2.x86 1/1 Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.252.b09-3.el8_2.x86 1/1 Verifying : java-1.8.0-openjdk-devel-1:1.8.0.252.b09-3.el8_2.x86 1/1 Installed products updated. Installed: java-1.8.0-openjdk-devel-1:1.8.0.252.b09-3.el8_2.x86_64 Complete! [[email protected] ~]$
자바가 성공적으로 설치되었는지 확인하려면 다음 명령어를 실행하십시오.
java -version
[[email protected] ~]$ java -version openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode) [[email protected] ~]$
설치가 완료되면 이제 젠킨스 설치를 진행합니다.
설치 단계
1단계: 먼저 명령 터미널을 엽니다.
2단계: 젠킨스를 설치하려면 먼저 젠킨스 GPG 키를 다운로드하고 추가해야 합니다.
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
[[email protected] ~]$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo --2020-06-21 04:29:52-- http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185, 64:ff9b::34ca:33b9 Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 85 Saving to: ‘/etc/yum.repos.d/jenkins.repo’ /etc/yum.repos.d/je 100%[==================>] 85 --.-KB/s in 0s 2020-06-21 04:29:54 (2.61 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85] [[email protected] ~]$
3단계: 젠킨스 GPG 키를 다운로드하여 추가한 후 젠킨스 GPG 키를 가져옵니다:
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
4단계: CentOS 패키지를 업데이트합니다.
sudo yum update
[[email protected] ~]$ sudo yum update Last metadata expiration check: 0:17:09 ago on Sun 21 Jun 2020 04:21:20 AM PDT. Dependencies resolved. Nothing to do. Complete! [[email protected] ~]$
5단계: CentOS 패키지를 업데이트한 후, 이제 젠킨스를 설치할 준비가 되었습니다.
sudo yum install jenkins
[[email protected] ~]$ sudo yum install jenkins Last metadata expiration check: 0:19:26 ago on Sun 21 Jun 2020 04:21:20 AM PDT. Dependencies resolved. =============================================================================== Package Architecture Version Repository Size =============================================================================== Installing: jenkins noarch 2.235.1-1.1 jenkins 63 M Transaction Summary =============================================================================== Install 1 Package Total download size: 63 M Installed size: 63 M Is this ok [y/N]: y Downloading Packages: jenkins-2.235.1-1.1.noarch.rpm 172 kB/s | 63 MB 06:16 ------------------------------------------------------------------------------- Total 172 kB/s | 63 MB 06:16 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: jenkins-2.235.1-1.1.noarch 1/1 Installing : jenkins-2.235.1-1.1.noarch 1/1 Running scriptlet: jenkins-2.235.1-1.1.noarch 1/1 Verifying : jenkins-2.235.1-1.1.noarch 1/1 Installed products updated. Installed: jenkins-2.235.1-1.1.noarch Complete! [[email protected] ~]$
6단계: systemctl을 통해 젠킨스를 시작합니다.
sudo systemctl start jenkins
systemctl은 출력을 표시하지 않으므로 다음 명령어를 사용하여 상태를 확인할 수 있습니다. 이 명령어를 통해 젠킨스가 활성화되었는지 확인할 수 있습니다.
sudo systemctl status jenkins
[[email protected] ~]$ sudo systemctl status jenkins [sudo] password for koreantech.org: ● jenkins.service - LSB: Jenkins Automation Server Loaded: loaded (/etc/rc.d/init.d/jenkins; generated) Active: active (running) Docs: man:systemd-sysv-generator(8) Jun 20 11:15:22 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automa> Jun 20 11:15:23 localhost.localdomain runuser[1456]: pam_unix(runuser:session)> Jun 20 11:15:33 localhost.localdomain jenkins[1433]: Starting Jenkins [ OK ] Jun 20 11:15:33 localhost.localdomain systemd[1]: Started LSB: Jenkins Automat> Jun 21 04:23:04 localhost.localdomain systemd[1]: Stopping LSB: Jenkins Automa> [[email protected] ~]$
7단계: 포트 구성 (선택 사항)
기본적으로 젠킨스는 8080 포트에서 실행되며, 필요한 경우 어디에서나 접근할 수 있도록 설정해야 합니다. 포트를 개방하려면,
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
[[email protected] ~]$ sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp success [[email protected] ~]$
포트 재로드를 구성한 후
sudo firewall-cmd --reload
[[email protected] ~]$ sudo firewall-cmd --reload success [[email protected] ~]$
젠킨스 구성하기
젠킨스가 설치되면 8080 포트에서 실행됩니다. 선호하는 브라우저에서 http://localhost:8080으로 이동하여 구성 과정을 시작합니다.
1단계: http://localhost:8080에 접속합니다.
2단계: 젠킨스의 잠금을 해제하려면 다음 위치에 있는 파일에서 관리자 암호를 복사합니다.
윈도우: C:프로그램 파일(x86)JenkinssecretsinitialAdminPassword
리눅스: /var/lib/jenkins/secrets/initialAdminPassword
복사한 관리자 암호를 ‘관리자 비밀번호’ 필드에 붙여넣고 ‘계속’ 버튼을 클릭합니다.
3단계: 제안된 플러그인을 설치하거나, 사용자 필요에 따라 플러그인을 선택할 수 있습니다. 여기서는 제안된 플러그인을 설치합니다.
4단계: 모든 플러그인이 설치될 때까지 기다립니다. 설치가 완료되면 ‘계속’을 클릭합니다.
5단계: 젠킨스 관리자 프로필을 생성합니다. 필요한 정보를 입력하고 ‘저장 후 계속’을 클릭합니다.
6단계: 필요한 경우 젠킨스 URL을 변경할 수 있습니다. 여기서는 기본값인 http://localhost:8080을 유지합니다. ‘저장 후 완료’를 클릭하여 설정 과정을 완료합니다. 이제 ‘젠킨스 사용 시작’을 클릭합니다.
마지막으로, 설정 과정이 완료되면, ‘Welcome to Jenkins!’ 페이지가 표시됩니다.
젠킨스 설정 단계는 관리자 암호를 찾아 입력해야 하는 2단계를 제외하고 모든 운영체제에서 유사하게 진행됩니다. 이 암호는 파일에서 찾을 수 있으며, 젠킨스 UI 잠금 해제 시 나타난 경로에 저장되어 있습니다.
결론
위에 제시된 단계를 통해 원하는 운영체제에 젠킨스를 성공적으로 설치할 수 있습니다. 다음 단계에서는 첫 번째 젠킨스 파이프라인을 만드는 방법을 알아보겠습니다.
젠킨스 설치는 간단하며, 원격 팀을 위해 설정해야 하는 경우 클라우드 VM을 사용하여 직접 설치하거나, 젠킨스 호스팅 플랫폼을 이용할 수 있습니다.