(CentOS7 기준)

 

의존성 설치

GitLab 설치를 위해 각종 의존성 패키지를 설치한다. 

sudo yum install -y curl policycoreutils-python openssh-server firewalld

ssh 데몬 실행

sudo systemctl enable sshd
sudo systemctl start sshd

방화벽 설정

firewalld를 통해 사용할 포트에 대한 방화벽을 오픈한다. 

systemctl start firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=8000/tcp
sudo systemctl reload firewalld

GitLab Community Edition Package 설치

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://localhost:8000" yum install -y gitlab-ce

설치 결과

gitlab Reconfigured!
       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/

Thank you for installing GitLab!
GitLab should be available at http://localhost:8000
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
  Verifying  : gitlab-ce-12.6.3-ce.0.el7.x86_64                                                                       1/1
Installed:
  gitlab-ce.x86_64 0:12.6.3-ce.0.el7                                                                                     
Complete!

GitLab Configure 변경(옵션)

GitLab을 호출할 url 또는 각종 설정 변경이 필요한 경우 gitlab.rb 파일을 수정하고 reconfigure를 실행한다. 

vim /etc/gitlab/gitlab.rb
external_url  'http://localhost:8888' ##변경 예시
gitlab-ctl reconfigure

GitLab 실행

Root 계정의 Password 변경 후 로그인한다. (ID: root PW:변경한 패스워드)


프로젝트 추가

목적에 맞게 프로젝트를 생성하여 추가한다. 

  • Private : 프로젝트 구성원에 의해 허가된 경우만 프로젝트 접근 가능
  • Internal : 로그인 된 유저만 프로젝트 접근 가능
  • Public : 별도의 권한 없이 프로젝트 접근 가능

프로젝트 멤버 추가

프로젝트를 생성한 후 Settings → Members →Invite member/group을 통해 현재 프로젝트에 멤버를 추가할 수 있다.

ID/Email, Role Permission, Access Expiration Date에 대해서 부여 가능하다. 

Guest

  • 프로젝트/코드 보기
  • 잡 리스트/로그 보기
  • 이슈 생성 및 보기

Reporter

  • 이슈 할당
  • 커밋 현황 보기
  • 프로젝트 통계 보기
  • 컨테이너 레지스트리 보기

Developer

  • 브랜치 생성/삭제
  • 보호 되지 않은(non-protected) 브랜치에 푸시
  • 컨테이너 레지스트리에 이미지 업데이트/삭제
  • 태그 생성/변경/삭제

Maintainer

  • 브랜치 보호/해제
  • 보호된 브랜치에 푸시
  • 팀 멤버 관리
  • GitLab 페이지 관리
  • 잡 트리거 관리
  • 프로젝트 수정

Owner

  • 프로젝트 가시성 변경
  • 프로젝트 삭제
  • 프로젝트를 다른 네임스페이스로 이전
  • 이슈삭제

*Master 브랜치는 기본값으로 보호(protected)되므로 Maintainer 이상의 권한을 가지고 있어야 push 가능하다.


SSH Key 등록

GitLab의 저장소로 코드를 push하기 위해서 SSH Key 등록이 필요하다. 

우측 상단 User → Settings → SSH Keys 탭을 통하여 등록 가능하며, 기존에 존재하는 키를 등록하거나 새로운 키를 생성할 수 있다. 

RSA 키 생성

ssh-keygen -t rsa -b 4096 -C "이 이메일 주소가 스팸봇으로부터 보호됩니다. 확인하려면 자바스크립트 활성화가 필요합니다."
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mobaxterm/.ssh/id_rsa): /home/mobaxterm/.ssh/gitlab_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/mobaxterm/.ssh/gitlab_rsa.
Your public key has been saved in /home/mobaxterm/.ssh/gitlab_rsa.pub.
The key fingerprint is:
SHA256:1+iUGXYRriQ9p/pA6Tt9AzzD7Zwjxsb6hNBrvsBIo/w 이 이메일 주소가 스팸봇으로부터 보호됩니다. 확인하려면 자바스크립트 활성화가 필요합니다.
The key's randomart image is:
+---[RSA 4096]----+
|            o.   |
|         . . .   |
|        . * +    |
|       . = %     |
|    o . SoO..    |
| . o + + B* .    |
|  o . o B+o* .   |
|   .   +.=B B    |
|    E   =Boo o   |
+----[SHA256]-----+

Public Key 등록

생성한 키를 등록한다.