> Hello World !!!

     

@syaku

형상관리를 위한 협업 개발 도구 GitLab


형상관리를 위한 협업 개발 도구 GitLab

형상관리를 할 수 있는 협업 개발 도구이다. 개발된 프로그램의 소스를 효율적으로 관리할 수 있는 도구이며 그외 사용자 및 위키, 이슈 관리 및 커뮤니티 등을 제공되어 편리하다.

원래 네이버에서 개발했던 요비(YOBI)를 사용해 왔지만 더이상 지원을 하지 않아 GitLab으로 이전하게 되었다. 기능면에서도 GitLab 월등이 좋지만 그래도 국내에 개발된 오픈소스를 기대했었기에 사용을 했었다. 하지만 변함없는 네이버... 버리는 건 잘하는 것 같다.

업그레이드: https://gist.github.com/syakuis/5dde519d74c01decdf76a1267f6c3b10


사이트 정보

사이트 : https://gitlab.com
설치 : https://about.gitlab.com/downloads
메뉴얼 : https://docs.gitlab.com/omnibus

GitLab 설치

CentOS 기반으로 설치했으며 설치메뉴얼을 참고하면 쉽게 완료할 수 있다. 우선 메일 발송을 위해 Postfix를 설치한다.

Postfix 설치

< / > CentOS 6

sudo yum install curl openssh-server openssh-clients postfix cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh

< ? > parameter inet_interfaces: no local interface found for ::1

서비스 시작시 실패할 경우 먼저 로그를 확인한다. 위와 같은 오류인 경우 아래와 같이 설정한다.

$ sudo tail -f /var/log/mailing // 로그 확인

$ sudo vi /etc/postfix/main.cf

inet_protocols = ipv4

< / > CentOS 7

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd

sudo yum install postfix

sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

systemctl: 서비스를 관리한다.
firewall: 방화벽을 관리한다.

GitLab 설치

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce

< / > GitLib 기본설정

$ sudo vi /etc/gitlab/gitlab.rb

설정 파일을 열어서 필요한 부분을 수정한다.

# 접속 호스트 설정
# https://localhost:8888
# http://localhost
# 위와 같이 프로토콜 호스트 포트 모두 한번에 설정한다.
external_url 'GENERATED_EXTERNAL_URL'

# SMTP Gmail 설정 (사용자 추가 및 비밀번호 변경시에 사용된다.)
# https://docs.gitlab.com/omnibus/settings/smtp.html#gmail
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "my.email@gmail.com"
gitlab_rails['smtp_password'] = "my-gmail-password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = falsegitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html

# GitLab user 부분에 사용자 계정과 그룹명을 입력하는 곳이 있다.
# GitLab 에서 사용할 정보인데 만약 이미 있는 정보라면 수정해줘야 한다.
# user['username'] = "git"
# user['group'] = "git"

저장하고 아래와 같이 설정을 반영한다.
$ sudo gitlab-ctl reconfigure

프로토콜을 HTTPS로 사용시 SSL 인증서를 생성해야 한다.
[참고] https://docs.gitlab.com/omnibus/settings/nginx.html#enable-https

$ cd /etc/gitlab

// 개인키 생성하기
$ sudo openssl genrsa -des3 -out localhost.key 1024

// 임시 비밀번호 입력 메세지
Enter pass phrase for localhost.key:
Verifying - Enter pass phrase for localhost.key:

// CSR 파일 생성하기
$ sudo openssl req -new -days 365 -key localhost.key -out localhost.csr

Country Name = KR
State or Province Name = 지역 시
Locality Name = 지역 구
Organization Name = 회사명
Organizational Unit Name = 부서명
Common Name = 도메인
Email = 이메일
Challenge password = 무시
optional company name = 무시

// 백업
$ sudo cp localhost.key localhost.key.bak
$ sudo openssl rsa -in localhost.key.bak -out localhost.key

// SSL 인증서 생성
$ sudo openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt

// ssl 폴더 생성 및 인증서 복사
$ sudo mkdir -p /etc/gitlab/ssl
$ sudo chmod 700 /etc/gitlab/ss
$ sudo cp localhost.key localhost.crt /etc/gitlab/ssl

서비스 시작과 종료 및 재설정

$ sudo gitlab-ctl start
$ sudo gitlab-ctl stop
$ sudo gitlab-ctl restart
$ sudo gitlab-ctl tail // 로그

https://localhost 사이트에 접속하면 관리자 암호를 설정하는 화면이 출력된다. 그리고 로그인 할때 관리자 계정은 root 이다.

클라이언트에서 HTTPS 로 접근할 때 아래와 같은 오류가 발생하면 클라이언트에서 명령어를 실행해준다.

< ? > certificate problem: Invalid certificate chain

$ sudo git config --global http.sslVerify false

방화벽 때문에 접속이 안될 경우 포트나 프로토콜 등록해준다. 흔히 생기는 문제이니 잊지 말자.