개발환경 구축

로컬 깃랩 세팅하기

codehunter 2023. 7. 14. 17:41

참조글은 https://ux.stories.pe.kr/161 을 참고해서 작성했다.

 

원래는 M1칩의 맥에서 세팅하려 했지만 실패후 정보검색을 해보니 2023.7 현재 M1 칩에서는 도커로 깃랩서버 설치가 잘 안된다고해서 리눅스로 변경했음.

https://gksdudrb922.tistory.com/214
https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/6659

 

글에서는 CentOS 7 환경에서 작업을 했지만 Rocky 리눅스 9.x 버전에서 작업을 진행했다.

 

참조글대로 하면 잘되는데 몇가지 시행착오를 겪은걸 적어봤다.

 

1. 설치중 "일치하는 인수가 없습니다: policycoreutils-python " 이 메세지 나오면
policycoreutils-python-utils 설치

2. /etc/gitlab/gitlab.rb 안에
external_url 'http://아이피:포트' 안에는 IP로 세팅하는게 별문제 없음. 도메인 이름으로 세팅하면 
되긴하는데 변경시 뭔가 문제가 생김. (아마 nginx쪽을 건드려야 하는듯) 당연히 파이월에서 포트열어야함.

3. 깃랩 설치후 웹에서 최초 root 비번은
cat /etc/gitlab/initial_root_password  | grep Password:

4. root 비번을 변경하려면
gitlab-rails console -e production
> user = User.where(id: 1).first
> user.password='변경할비밀번호'
> user.password_confirmation='변경할비밀번호'
> user.save

 

이밖에 하드추가라든지 파이어월 세팅등은 블로그에 잘 설명되어 있으니 참고하면 된다.

 

openssh 설치하기

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

 

서버 부팅 시 sshd 실행

sudo systemctl enable sshd
sudo systemctl start sshd

 

방화벽 해제 및 재실행

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

 

메일서버 설치

sudo yum install postfix

 

서버 부팅시 메일 서버 실행

sudo systemctl enable postfix
sudo systemctl start postfix

 


gitlab 패키지 설치하기

 

패키지 저장소 등록

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

 

패키지 설치

sudo EXTERNAL_URL="자신의 도메인이나 접속가능한 IP:접속할 Port번호" yum install -y gitlab-ce

예시

sudo EXTERNAL_URL="192.168.0.102:8001" yum install -y gitlab-ce

설치시 시간이 좀 소요된다. (빠르면 10분 늦으면 30분이상)

 

다 끝나고 나면 브라우저에서 위 아이피와 포트주소로 접속하면 아래와 같은 화면이 뜨는데 이 화면이 뜨면 절반은 성공한거다. 

최초접속시 접속이 안되면 일차적으로 파이어월에서 포트가 열렸는지 확인해보고 열어주면 거의 대부분 해결된다.

firewall-cmd --permanent --add-port=위에서설정한 포트/tcp
firewall-cmd --reload