[Devops] Jenkins 설치 및 초기세팅

황인용·2021년 2월 8일
0

Devops

목록 보기
1/7
post-thumbnail
post-custom-banner

jenkins 설치

  1. sudo apt-get update
sudo apt-get update
  1. sudo apt install openjdk-8-jre
sudo apt install openjdk-8-jre -y
  1. check java version
java -version

openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~18.04-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
  1. wget add the jenkins key
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
  1. add repository
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
  1. install jenkins
sudo apt install jenkins -y

--

jenkins service 확인

  1. Jenkins service 확인
    1-1. netstat
netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 :::8080                 :::*                    LISTEN

1-2. systemctl status

systemctl status jenkins

● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: active (exited) since Mon 2021-02-08 03:24:00 UTC; 43s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 1140)
   CGroup: /system.slice/jenkins.service

Feb 08 03:23:59 ip-172-31-47-24 systemd[1]: Starting LSB: Start Jenkins at boot time...
Feb 08 03:23:59 ip-172-31-47-24 jenkins[16659]: Correct java version found
Feb 08 03:23:59 ip-172-31-47-24 jenkins[16659]:  * Starting Jenkins Automation Server jenkins
Feb 08 03:23:59 ip-172-31-47-24 su[16710]: Successful su for jenkins by root
Feb 08 03:23:59 ip-172-31-47-24 su[16710]: + ??? root:jenkins
Feb 08 03:23:59 ip-172-31-47-24 su[16710]: pam_unix(su:session): session opened for user jenkins by (uid=0)
Feb 08 03:23:59 ip-172-31-47-24 su[16710]: pam_unix(su:session): session closed for user jenkins
Feb 08 03:24:00 ip-172-31-47-24 jenkins[16659]:    ...done.
Feb 08 03:24:00 ip-172-31-47-24 systemd[1]: Started LSB: Start Jenkins at boot time.

jenkins service port 변경

  1. jenkins default 설정 확인 및 변경
  • HTTP_PORT 가 default 8080으로 설정되어 있음
  • 운영환경에 따라 원하는 service port로 변경

1-1. /etc/default/jenkins HTTP_PORT 확인

cat /etc/default/jenkins
...
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080
...

1-2. /etc/default/jenkins HTTP_PORT 변경

sudo vi /etc/default/jenkins
...
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT = 9000

...

:wq
  1. jenkins service 시작/정지 또는 재시작
sudo service jenkins stop
sudo service jenkins start
sudo service jenkins restart

jenkins 접속 및 초기 설정

  1. ec2 security_group 확인 및 변경
  • jenkins의 service port를 inbound 정책에서 허용해줘야함
    ec2-security_group(jenkins)
  1. jenkins 관리자 페이지 접속
  • http:{ip}:{service_port}/ 로 접속
  • 페이지의 디렉토리의 초기 패스워드 확인 및 입력
  1. Customize Jenkins
  • Install suggested plugins 선택
  1. Getting Started
  • 기본 플러그인 설치
  • 차 한잔 하고 오면 됨
  1. Create First Admin User
  • 초기 어드민 계정 생성
  • 패스워드 까먹으면...안됨
  1. 젠킨슨은 준비됬어!
profile
dev_pang의 pang.log
post-custom-banner

0개의 댓글