본문 바로가기

Tool

[GitLab]GitLab + Gitlab CI 설치

728x90

형상관리 툴 중 하나인 Git 에 대하여 서버환경을 제공하는 GitLab에 대한 설치를 가이드 하고자 합니다.


먼저 GitLab 홈페이지에서 다운로드 및 설치 방법이 가이드 되어있습니다.


(Ubuntu 14.04, Gitlab 7.7.1-omnibus.5.4.1.ci 버전 기준입니다.)

1. wget을 이용하여 omnibus 패키지를 다운 받습니다.

oofbird@ubuntu:~/gitlab$ wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb

--2015-01-26 22:23:53--  https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb

Resolving downloads-packages.s3.amazonaws.com (downloads-packages.s3.amazonaws.com)... 54.231.136.18

Connecting to downloads-packages.s3.amazonaws.com (downloads-packages.s3.amazonaws.com)|54.231.136.18|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 311759950 (297M) [application/x-debian-package]

Saving to: ‘gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb’


100%[========================================================================================>] 311,759,950 1.86MB/s   in 2m 29s 


2015-01-26 22:26:24 (2.00 MB/s) - ‘gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb’ saved [311759950/311759950]


oofbird@ubuntu:~/gitlab$


명령어를 입력하면 deb 파일을 받게 됩니다.


2. dpkg -i 명령을 이용하여 패키지를 설치합니다. (dpkg는 기본적으로 관리자 권한이 필요합니다.)


oofbird@ubuntu:~/gitlab$ sudo dpkg -i gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb 

[sudo] password for oofbird: 

Selecting previously unselected package gitlab.

(Reading database ... 54265 files and directories currently installed.)

Preparing to unpack gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb ...

Unpacking gitlab (7.7.1-omnibus.5.4.1.ci-1) ...

Setting up gitlab (7.7.1-omnibus.5.4.1.ci-1) ...

Thank you for installing GitLab!

Configure and start GitLab by running the following command:


sudo gitlab-ctl reconfigure


GitLab should be reachable at http://ubuntu

Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file

And running reconfigure again.


oofbird@ubuntu:~/gitlab$ 


3. 설치가 완료되면 설정을 변경하도록 합니다. 경로는 /etc/gitlab에 있으며 수정할 파일은 gitlab.rb 파일입니다.

수정을 하기 위해서는 관리자 권한이 필요하므로 다음 명령으로 수정을 진행합니다.

oofbird@ubuntu:~/gitlab$ sudo vi /etc/gitlab/gitlab.rb


여러가지 항목 중 다음을 수정합니다.

  • external_url 'http://[GitLab을 서비스할 주소]'
  • gitlab_rails['time_zone'] = 'KST' << 한국시간기준
  • gitlab_rails['root_password'] = "[root 계정의 비밀번호]"
  • ci_external_url 'http://[GitLab CI를 서비스할 주소]'
    • 웹사이트 설명에서는 DNS를 이용하여 다른 주소로 서비스가 가능하다고 합니다.
    • 저의 경우에는 DNS가 없어서 별도 포트로 설정하며 다음과 같이 입력하였습니다. (http://192.168.0.18:8080')
  • gitlab_ci['gitlab_server'] = { "url" => 'http://[GitLab을 서비스할 주소]', "app_id" => '[GitLab에 등록된 CI서버 APP ID]', "app_secret" => '[GitLab에 등록된 CI서버 비밀키]' }
    • 순서상 주석으로 작업하고 gitlab에서 Application을 추가해야 됩니다.
4. 수정이 완료되면 다음 명령으로 재설정 하면 됩니다.
oofbird@ubuntu: ~/gitlab$ sudo gitlab-ctl reconfigure


반응형