Centos8 搭建本地gitlab服務器筆記


文檔地址:https://packages.gitlab.com/gitlab/gitlab-ce

一、安裝gitlab所需依賴(如果沒有)

$ sudo yum install curl openssh-server openssh-clients postfix cronie  

安裝之前可以先檢查一下系統是否已經安裝了上面的工具,如果已安裝過就不用再安裝了。

二、安裝gitlab

$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
$ dnf install -y gitlab-ce

三、配置ssl證書

$ mkdir -p /etc/gitlab/ssl

$ cd /etc/gitlab/ssl

$ openssl genrsa -out "/etc/gitlab/ssl/gitlab.example.com.key" 2048

$ openssl req -new -key "/etc/gitlab/ssl/gitlab.lwt.com.key" -out "/etc/gitlab/ssl/gitlab.lwt.com.csr"

$ openssl x509 -req -days 365 -in "/etc/gitlab/ssl/gitlab.lwt.com.csr" -signkey "/etc/gitlab/ssl/gitlab.lwt.com.key" -out "/etc/gitlab/ssl/gitlab.lwt.com.crt"

$ openssl dhparam -out /etc/gitlab/ssl/dhparams.pem 2048
# 修改權限
$ chmod 600 *

# 修改gitlab.rb中的下面三項配置為前面步驟所創建的文件
# nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.com.crt"
# nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.lwt.com.key"
# nginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparams.pem"
$ vim /etc/gitlab/gitlab.rb

四、 初始化gitlab相關配置

# 初始化gitlab相關配置
$ gitlab-ctl reconfigure

五、修改/var/opt/gitlab/nginx/conf/gitlab-http.conf

server_name gitlab.example.com;
rewrite ^(.*)$ https://$host$1 permangent

六、重啟gitlab服務

$ sudo gitlab-ctl restart

七、將gitlab服務器ip地址和上面配置的域名(gitlab.example.com)的對於關系配置到客戶端電腦上(可選,可以直接使用ip訪問)

window:(C:\Windows\System32\drivers\etc\hosts)

gitlabip gitlab.example.com

linux:(vim /etc/hosts)

gitlabip gitlab.example.com

ps:在Centos8上安裝新版本的gitlab好像需要內存在2G以上,內存不足2G時初始化配置時會報錯:

* Errno::ENOMEM occurred in delayed notification: execute[reload all sysctl conf] (package::sysctl line 18) had an error: Errno::ENOMEM: Cannot allocate memory - fork(2)
* Errno::ENOMEM occurred in delayed notification: runit_service[gitlab-workhorse] (gitlab::gitlab-workhorse line 49) had an error: Errno::ENOMEM: Cannot allocate memory - fork(2)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM