Linux 7 설치
설치 파일
사전 준비 사항
1. 필수 사항
- policycoreutils-python / openssh-server / openssh-clients / git2.29 이상
2. 선택 사항
curl / ca-certificates / postfix
GitLab 설치
offline 설치 방법
(1) offline-{파일명}.tar.gz 압축 해제
(2) offline-{파일명}.repo 파일 복사 → /etc/yum.repos.d 디렉토리
(3) offline-{파일명} 디렉토리 복사 → /var/tmp 디렉토리
(4) 설치 진행
- yum -y install --disablerepo=\* --enablerepo=offline-{파일명} {파일명}
-- Git 설치 $ tar -xvf offline-git-2.30.tar.gz $ cp -r git /var/tmp/ $ cp -r offline-git.repo /etc/yum.repos.d/ $ yum -y install --disablerepo=\* --enablerepo=offline-git git -- Gitlab 설치 $ tar -xvf offline-gitlab-ee.13.9.tar.gz $ cp -r gitlab-ee /var/tmp/ $ cp -r offline-gitlab-ee.repo /etc/yum.repos.d/ $ yum -y install --disablerepo=\* --enablerepo=offline-gitlab-ee gitlab-ee
rpm 설치
- 디렉토리 정보
정보 | 디렉토리 경로 |
---|---|
설치 디렉토리 | /opt/gitlab |
설정 파일 디렉토리 | /etc/gitlab |
데이터 디렉토리 | /var/opt/gitlab |
로그 디렉토리 | /var/log/gitlab |
포트 변경
* 포트 링크
https://docs.gitlab.com/omnibus/package-information/defaults.html
$ vi /etc/gitlab/gitlab.rb 1.external_url 에서 포트 변경 external_url 'http://192.168.137.13:7990' 2. Advanced settings에서 주석 제거,포트 변경 puma['port'] = 8080 # 디폴트 포트가 자주 사용하는 포트이므로 확인 후 변경
Repository 디렉토리 변경
$ vi /etc/gitlab/gitlab.rb For setting up different data storing directory ! Docs: https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory ! **If you want to use a single non-default directory to store git data use a ! path that doesn't contain symlinks.** git_data_dirs({ "default" => {"path" => "/test/git-data"} # Repository 디렉토리 입력 })
설정 변경
- 최초 reconfigure 실행
$ gitlab-ctl reconfigure
시작 / 종료 / 재시작
$ gitlab-ctl start $ gitlab-ctl stop $ gitlab-ctl restart
GitLab 백업 방법
* 백업 링크
https://docs.gitlab.com/omnibus/settings/backups.html
https://docs.gitlab.com/ee/raketasks/backup_restore.html#back-up-gitlab
< config 백업 > EX)명령어 : sudo gitlab-ctl backup-etc {경로 입력} # 디폴트 디렉토리 : /etc/gitlab/config_backup $ sudo gitlab-ctl backup-etc /test/gitlab_backup <data 백업> $ sudo gitlab-backup create $ vi /etc/gitlab/gitlab.rb 설정 에서 변경 가능 -> 주석 제거,디렉토리 변경 -> gitlab-ctl reconfigure 진행 gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
백업 Crontab 설정
$ vi /opt/gitlab/bin/gitlab_cron.sh gitlab-ctl backup-etc /test/gitlab_backup gitlab-backup create $chmod +x /opt/gitlab/bin/gitlab_cron.sh $crontab -e 0 1 * * * /opt/gitlab/bin/gitlab_cron.sh # 매일 오전 1시 백업을 예약
서비스 등록
$ vi /etc/systemd/system/gitlab-run.service ============================================== [Unit] Description=gitlab server Service [Service] user=root ExecStart=/opt/gitlab/bin/gitlab-ctl start [Install] WantedBy=multi-user.target ============================================== $ systemctl enable gitlab-run.service $ systemctl daemon-reload $ systemctl start gitlab-run.service $ systemctl status gitlab-run.service