웹사이트 검색

Alma Linux 8에 GitLab 설치


이 페이지에서

  1. 전제 조건
  2. GitLab CE 저장소 추가
  3. Alma Linux 8에 GitLab CE 설치
  4. GitLab CE 구성
  5. 방화벽 구성\n
  6. GitLab CE 액세스
  7. GitLab 백업 구성
  8. GitLab 루트 암호 재설정\n
  9. 결론

GitLab은 단일 애플리케이션에서 소프트웨어를 개발, 보호 및 운영하기 위한 여러 도구와 함께 제공되는 무료 오픈 소스 DevOps 소프트웨어입니다. 무료 무제한 리포지토리와 무제한 공동 작업자를 제공합니다. 주로 문제 추적과 같은 추가 개발 관련 기능과 함께 Git 리포지토리를 호스팅하는 데 사용됩니다. Github 및 Bitbucket과 매우 유사하며 개인 및 팀이 다른 사람과 원격으로 코드를 공유할 수 있습니다.

GitLab은 다음 네 가지 주요 버전으로 제공됩니다. -medrectangle-3-0;var ffid=1;var alS=1021%1000;var container=document.getElementById(slotId);container.style.width=100%;var ins=document.createElement(ins);ins. id=slotId+-asloaded;ins.className=adsbygoogle ezasloaded;ins.dataset.adClient=pid;ins.dataset.adChannel=cid;if(ffid==2){ins.dataset.fullWidthResponsive=true;}

  • GitLab Community Edition - 무료, 오픈 소스 및 자체 호스팅.\n
  • GitLab Enterprise Edition - 추가 기능이 포함된 자체 호스팅 및 유료.\n
  • GitLab.com - 무료 및 SaaS.
  • GitLab.io - GitLab Inc.에서 관리하는 비공개 GitLab 인스턴스\n

이번 포스트에서는 Alma Linux 8에 GitLab CE를 설치하는 방법에 대해 설명하겠습니다.

전제 조건

  • Alma Linux 8을 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 루트 암호는 서버에서 구성됩니다.\n

GitLab CE 리포지토리 추가

기본적으로 GitLab 패키지는 Alma Linux 기본 리포지토리에 포함되어 있지 않습니다. 따라서 시스템에 GitLab 공식 리포지토리를 추가해야 합니다. 다음 스크립트를 다운로드하고 추가하여 GitLab 리포지토리를 추가할 수 있습니다.

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

다음과 같은 결과가 표시됩니다.

Complete!
Generating yum cache for gitlab_gitlab-ce...
Importing GPG key 0x51312F3F:
 Userid     : "GitLab B.V. (package repository signing key) <>"
 Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0xF27EAB47:
 Userid     : "GitLab, Inc. <>"
 Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Generating yum cache for gitlab_gitlab-ce-source...

The repository is setup! You can now install packages.

다음 명령을 사용하여 설치된 리포지토리를 확인할 수 있습니다.

cat /etc/yum.repos.d/gitlab_gitlab-ce.repo

다음과 같은 결과가 표시됩니다.

[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
       https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

다음 명령을 사용하여 GitLab 저장소를 나열할 수도 있습니다.

dnf repolist

다음과 같은 결과가 표시됩니다.

repo id                                                               repo name
appstream                                                             Rocky Linux 8 - AppStream
baseos                                                                Rocky Linux 8 - BaseOS
extras                                                                Rocky Linux 8 - Extras
gitlab_gitlab-ce                                                      gitlab_gitlab-ce
gitlab_gitlab-ce-source                                               gitlab_gitlab-ce-source

Alma Linux 8에 GitLab CE 설치

이 시점에서 시스템에 GitLab 저장소가 생성됩니다. 이제 다음 명령을 실행하여 GitLab CE를 설치할 수 있습니다.

dnf install gitlab-ce -y

GitLab CE가 설치되면 다음과 같은 결과가 표시됩니다.

It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


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

Please configure a URL for your GitLab instance by setting `external_url`
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=14-8


  Verifying        : gitlab-ce-14.8.2-ce.0.el8.x86_64                       1/1 

Installed:
  gitlab-ce-14.8.2-ce.0.el8.x86_64                                              

Complete!

GitLab CE 구성

다음으로 GitLab 구성 파일에서 도메인 이름을 정의해야 합니다. 이렇게 하려면 GitLab 구성 파일을 편집합니다.

nano /etc/gitlab/gitlab.rb

도메인 이름으로 다음 줄을 변경합니다.

external_url 'http://gitlab.example.com'

파일을 저장하고 닫은 후 다음 명령을 사용하여 GitLab을 다시 구성합니다.

gitlab-ctl reconfigure

GitLab CE가 재구성되면 다음과 같은 결과가 표시됩니다.

Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.

NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

gitlab Reconfigured!

이제 다음 명령을 사용하여 GitLab CE의 상태를 확인할 수 있습니다.

gitlab-ctl status

다음과 같은 결과가 표시됩니다.

run: gitaly: (pid 26684) 69s; run: log: (pid 25075) 351s
run: gitlab-exporter: (pid 26617) 73s; run: log: (pid 25555) 207s
run: gitlab-kas: (pid 26585) 75s; run: log: (pid 25339) 334s
run: gitlab-workhorse: (pid 26595) 74s; run: log: (pid 25472) 229s
run: grafana: (pid 26665) 70s; run: log: (pid 26315) 110s
run: logrotate: (pid 25000) 364s; run: log: (pid 25008) 363s
run: nginx: (pid 25488) 226s; run: log: (pid 25499) 222s
run: node-exporter: (pid 26603) 74s; run: log: (pid 25541) 213s
run: postgres-exporter: (pid 26659) 70s; run: log: (pid 25891) 168s
run: postgresql: (pid 25207) 341s; run: log: (pid 25218) 340s
run: prometheus: (pid 26631) 72s; run: log: (pid 25629) 194s
run: puma: (pid 25406) 249s; run: log: (pid 25417) 246s
run: redis: (pid 25039) 358s; run: log: (pid 25047) 357s
run: redis-exporter: (pid 26620) 73s; run: log: (pid 25575) 201s
run: sidekiq: (pid 25423) 243s; run: log: (pid 25435) 239s

GitLab을 중지하려면 다음 명령을 실행합니다.

gitlab-ctl stop

GitLab을 시작하려면 다음 명령을 실행합니다.

gitlab-ctl start

완료되면 다음 단계로 진행할 수 있습니다.

방화벽 구성

다음으로 방화벽을 통해 HTTP 서비스를 허용해야 합니다. 다음 명령을 사용하여 허용할 수 있습니다.

firewall-cmd --permanent --add-service=http

다음으로 firewalld 데몬을 다시 로드하여 변경 사항을 적용합니다.

systemctl reload firewalld

방화벽이 구성되면 다음 단계를 진행할 수 있습니다.

GitLab CE에 액세스

GitLab CE에 액세스하기 전에 다음 명령을 사용하여 GitLab 루트 비밀번호를 검색하십시오.

cat /etc/gitlab/initial_root_password

다음 출력에 GitLab CE 루트 암호가 표시되어야 합니다.

# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: XIlQ4/J7oQ49ZdNuGZto3f5vEJGHZJSTRSIuYL9z0/k=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

이제 웹 브라우저를 열고 URL http://gitlab.example.com을 사용하여 GitLab 웹 인터페이스에 액세스하십시오. GitLab 로그인 페이지로 리디렉션됩니다.

루트 사용자 이름과 비밀번호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에 GitLab 웹 인터페이스가 표시되어야 합니다.

GitLab 백업 구성

GitLab을 사용하면 GitLab 인스턴스의 백업을 생성할 수도 있습니다. GitLab 인스턴스의 백업을 만들려면 다음 명령을 실행합니다.

gitlab-rake gitlab:backup:create

백업이 생성되면 다음과 같은 결과가 표시됩니다.

2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping uploads ... 
2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping builds ... 
2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping artifacts ... 
2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping pages ... 
2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping lfs objects ... 
2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping terraform states ... 
2022-03-11 11:13:11 +0000 -- done
2022-03-11 11:13:11 +0000 -- Dumping container registry images ... 
2022-03-11 11:13:11 +0000 -- [DISABLED]
2022-03-11 11:13:11 +0000 -- Dumping packages ... 
2022-03-11 11:13:11 +0000 -- done
Creating backup archive: 1646997191_2022_03_11_14.8.2_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done

기본적으로 GitLab 백업은 /var/opt/gitlab/backups에 저장됩니다. /etc/gitlab/gitlab.rb에 있는 GitLab 구성 파일의 설정을 편집하여 백업 경로를 변경할 수 있습니다.

다음 명령을 사용하여 생성된 백업을 확인할 수 있습니다.

ls /var/opt/gitlab/backups

다음과 같은 결과가 표시됩니다.

1646997191_2022_03_11_14.8.2_gitlab_backup.tar

GitLab 루트 암호 재설정

GitLab 관리자 암호를 잊어버린 경우 다음 명령을 사용하여 쉽게 재설정할 수 있습니다.

gitlab-rake "gitlab:password:reset"

아래와 같이 새 비밀번호를 설정하라는 메시지가 표시됩니다.

Enter username: root
Enter password: 
Confirm password: 
Password successfully updated for user with username root.

결론

축하합니다! Alma Linux 8에 GitLab CE를 성공적으로 설치했습니다. 이제 개발 환경에서 GitLab을 사용할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.