https://packages.gitlab.com/app/gitlab/gitlab-ce/search?dist=ubuntu&filter=debs&page=4&q=
下载包
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/jammy/gitlab-ce_16.8.3-ce.0_amd64.deb/download.deb
安装
dpkg -i gitlab-ce_16.8.3-ce.0_amd64.deb
配置
http访问
# cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.bak
# egrep -v "^$|#" /etc/gitlab/gitlab.rb
external_url 'http://gitlab.test.com'
prometheus_monitoring['enable'] = false
https访问(证书可以用阿里云免费的)
# egrep -v "^$|#" /etc/gitlab/gitlab.rb
external_url 'https://gitlab.test.com'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.test.com.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.test.com.key"
prometheus_monitoring['enable'] = false
加载配置
gitlab-ctl reconfigure
起停、重启
gitlab-ctl start
gitlab-ctl stop
gitlab-ctl restart
gitlab-ctl status
如果想用nginx做代理,配置如下(可选)
cat gitlab.conf
server {
listen 80;
server_name gitlab.test.com;
access_log /var/log/nginx/gitlab.log main;
location / {
proxy_pass http://your.gitlab.server.ip;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}