on
Centos 7 초기 설정 및 Jenkins 설정
Centos 7 초기 설정 및 Jenkins 설정
반응형
사용 서버: Centos 7.7v, Docker
1. Docker 설정
# failed to get D-bus connection 문제 해결 $ docker run --privileged -d --name myblog centos:7.7.1908 /sbin/init $ docker exec -it myblog /bin/bash
2. SSH 사용 Setting
# SSH 시작을 위한 세팅 $ yum update -y $ yum install openssh-server # 설치 확인 $ rpm -qa | grep -i openssh-server # ssh config $ vi /etc/ssh/sshd_config # 주석 제거 PORT 22 LoginGraceTime 2m # 사용자 인증 최대 시간 설정 PermitRootLogin yes # root 로그인 가능 여부 StrictModes yes # 엄격 모드 활성화 여부 MaxAuthTries 6 # 최대 접속 시도 수 설정 MaxSessions 10 # 동시 접속 클라이언트 수 설정 # sshd 시작 $ systemctl start sshd $ systemctl status sshd
3. Jenkins 설정
# Repo 파일 준비 $ wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo # Public key 세팅 $ rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key # 설치 시작 $ yum install epel-release # repository that provides 'daemonize' $ yum install java-11-openjdk-devel $ yum install jenkins $ yum install initscripts # Port 변경 $ vi /etc/sysconfig/jenkins JENKINS_PORT=8088 # Jenkins 시작 $ systemctl enable jenkins # 자동시작 $ systemctl start jenkins # Jenkins 접속 http://conative.myds.me:8088 # 초기 비밀번호 입력 $ cat /var/lib/jenkins/secrets/initialAdminPassword # Install suggested plugins 실행 # JDK 심볼릭 링크 위치 확인 $ readlink -f /usr/bin/java #> /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el7_9.x86_64/bin/java # JDK 환경변수 적용 - 끝 줄에 추가 $ vi /etc/profile JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el7_9.x86_64 PATH=$PATH:$JAVA_HOME/bin CLASSPATH=$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar # 환경변수 적용 $ source /etc/profile # 환경변수 적용 확인 $ echo $JAVA_HOME $ echo $PATH $ echo $CLASSPATH # Jenkins 설정에서, Jenkins 관리 > Global Tool Configuration > ADD JDK # Name(openjdk-11), JAVA_HOME 경로 작성 # Jenkins 관리 > 플러그인 관리 > 설치 가능 > Nodejs 검색 후 download and restart # Git 설치 $ yum install git # Jenkins 설정에서, Jenkins 관리 > Global Tool Configuration > GIT # Name(Git default), path작성 (whereis git) # Jenkins > 새로운 Item > Freestyle project # 1. General > 설명란작성 # 2. 소스 코드 관리 > Git 선택 > Repo url 입력 # 2-1. credentials > Add > Jenkins # 2-1-1. kind > username with password # 2-1-2. Scope(global), Username(Positive-Conative = 아이디), ID(=Username -암거나 입력), PW 입력 # 2-2. 설정한 Credentials 선택. # 2-2. Branch Specifier (*/master 입력) # 3. Build Trigger(빌드 유발) > GitHub hook trigger for GITScm polling (푸시 시마다 빌드) 클릭 # 3-1. github repo > settings > webhooks > Add webhook 클릭 # 3-2. payload url : jenkinsurl/github-webhook/ (http://conative.myds.me:8088/github-webhook/) # 3-3. content type: application/json # 3-4. just the push event 클릭 ※출처 및 참고자료 https://pkg.jenkins.io/redhat-stable/ https://hitomis.tistory.com/127 https://dbjh.tistory.com/66 https://alsyean.tistory.com/57
반응형
from http://conative.tistory.com/24 by ccl(A) rewrite - 2021-10-11 21:26:28