[카카오 챗봇] 젠킨스 설치

nayoon·2021년 1월 18일
1

boanbot

목록 보기
2/6

카카오 챗봇 서버를 aws에 올리는데 자동화 배포 ci를 이용하기 위해서 젠킨스를 사용하기로 했다.

https://junghwanta.tistory.com/23 를 참고해서 젠킨스 설치를 진행하였다.

ec2: ubuntu 20.04.01 LTS (GNU/Linux 5.4.0-1029-aws x86_64)

1. 먼저 자바 8버전을 설치한다.

~$ sudo apt install openjdk-8-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openjdk-8-jre

위와 같이 명령어를 치자마자 'Unable to locate package openjdk-8-jre'가 나왔다.

혹시나 해서 아래와 같이 명령어를 입력하였다.

~$ sudo apt-get update

그 후, 다시 자바 8버전 설치를 시도하였다.

~$ sudo apt install openjdk-8-jre

설치가 잘 되었다.

2. 젠킨스 설치를 위한 repository key, repository 추가 후 설치

~$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -

OK
~$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list

위의 명령어를 입력하는데 아래와 같이 조금 삽질했지만 금방 해결했다.

# 삽질 1)
~$ sh -C 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sh: 0: Can't open echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list

'# sh -C 에서 -C는 대문자가 아니라 소문자 -c다.

# 삽질 2)

~$ sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sh: 1: cannot create /etc/apt/sources.list.d/jenkins.list: Permission denied

# Permission denied인 것을 보고 sh 앞에 sudo를 입력했다.
~$ sudo apt-get update

Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:4 https://pkg.jenkins.io/debian-stable binary/ InRelease
Get:6 https://pkg.jenkins.io/debian-stable binary/ Release [2044 B]
Get:7 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
Ign:7 https://pkg.jenkins.io/debian-stable binary/ Release.gpg
Reading package lists... Done
W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCEF32E745F2C3D5
E: The repository 'http://pkg.jenkins.io/debian-stable binary/ Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

잘 살펴보면

'W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY <퍼블릭키>'

와 같이 에러가 발생했다.

업데이트에 실패한 것이다. 슬퍼할 겨를이 없다.

https://hbot.tistory.com/40 를 찾아보니 GPG error가 나서 업데이트에 실패했다고 한다.

아래와 같이 입력한 후 업데이트를 진행하니 업데이트가 성공하였다.

~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <퍼블릭키>

~$ sudo apt-get update
Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:4 https://pkg.jenkins.io/debian-stable binary/ InRelease
Get:5 https://pkg.jenkins.io/debian-stable binary/ Release [2044 B]
Get:6 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
Hit:7 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:8 https://pkg.jenkins.io/debian-stable binary/ Packages [19.0 kB]
Fetched 21.9 kB in 1s (39.7 kB/s)
Reading package lists... Done

젠킨스 설치 명령어를 입력한다.

~$ sudo apt-get install jenkins

3. systemctl을 이용해 젠킨스를 실행

~$ sudo systemctl start jenkins
Failed to start jenkins.service: Unit jenkins.service not found.

jenkins.service를 찾을 수 없어서 실행에 실패하였다. 슬퍼할 겨를이 없다.

알고보니 젠킨스 설치가 안 되어있었다. 안 슬퍼하길 잘했다.

~$ sudo apt-get install jenkins
~$ sudo systemctl start jenkins

다시 젠킨스 설치를 해주고 젠킨스를 실행하니 아래와 같이 실행 성공한 것을 확인할 수 있었다.

administrator password 얻기

~$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword

password를 입력하면 아래와 같이 로그인 성공

플러그인을 설치하는 화면이 아래와 같이 뜬다.

플러그인 설치 후 아래와 같이 첫 admin user 생성 화면이 뜬다.

계정 정보 입력 후 jenkins url까지 입력하고 나면 아래와 같은 화면이 뜬다.

Start using Jenkins 를 클릭하면 아래와 같은 화면이 뜨면 모든 젠킨스 설치가 끝나게 된다.

profile
뚜벅뚜벅 열심히 공부하는 개발자

0개의 댓글