gitlab安装和简要配置
2020-02-29 本文已影响0人
jlma7
gitlab
有关资料介绍先看官网:https://gitlab.com/
gitlab ee :Enterprise Edition
gitlab ce :Community Edition
基于CentOS 7的gitlab ce,服务器配置最好2c4G以上
install
step 1 pre env
参考官网:https://about.gitlab.com/install/?version=ce
sudo yum install -y curl policycoreutils-python openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
# 可忽略firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
# SMTP server
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
step 2 download package
Add the GitLab package repository and install the package
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
太慢了,需要配置yum mirrors
vim /etc/yum.repos.d/gitlab-ce-tsinghua.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
yum clean all
yum makecache
yum install gitlab-ce
other configure
Domain
在自己的域名配置平台自行配置添加
编辑 /etc/gitlab/gitlab.rb
external_url 'http://gitlab.${your domain}'
使用其他nginx作为入口
编辑 /etc/gitlab/gitlab.rb
unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 8093
nginx['listen_addresses'] = ['*']
nginx['listen_port'] = 94
gitlab_rails['gitlab_shell_ssh_port'] = 24
在入口nginx的配置目录追加配置
touch gitlab.conf
vim gitlab.conf
server {
listen 80;
server_name gitlab.${your domain};
location / {
proxy_redirect off;
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_pass http://localhost:8094;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
常用命令
重新加载配置
gitlab-ctl reconfigure
重启
gitlab-ctl restart
查看状态
gitlab-ctl status