GitLab介绍:
GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。
GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。
1、安装依赖包
[root@localhost ~]# yum install curl policycoreutils openssh-server openssh-clients postfix -y
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[root@localhost ~]# yum install -y gitlab-ce
[root@localhost
~]# yum install -y git
2、生成SSL证书
[root@gitlab ~]# mkdir -p
/etc/gitlab/ssl
[root@gitlab ~]# openssl genrsa
-out "/etc/gitlab/ssl/gitlab.pso.com.key" 2048
[root@gitlab ~]# openssl req -new
-key "/etc/gitlab/ssl/gitlab.pso.com.key" -out
"/etc/gitlab/ssl/gitlab.pso.com.csr"
[root@gitlab ssl]# openssl x509
-req -days 3650 -in "/etc/gitlab/ssl/gitlab.pso.com.csr" -signkey
"/etc/gitlab/ssl/gitlab.pso.com.key" -out
"/etc/gitlab/ssl/gitlab.pso.com.crt"
[root@gitlab ssl]# openssl dhparam
-out /etc/gitlab/ssl/dhparams.pem 2048
3、需改Gitlab配置文件中的SSL
[root@gitlab ssl]# vim
/etc/gitlab/gitlab.rb
external_url 'https://gitlab.pso.com'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.pso.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.pso.com.key"
# nginx['ssl_dhparam'] =
/etc/gitlab/ssl/dhparams.pem
4、配置并启动Gitlab
Gitlab-ctl reconfigure
Gitlab-ctl status
Gitlab-ctl stop
Gitlab-ctl start
5、gitlab默认使用80或443端口,可以通过
lsof -i:80 查看
[root@localhost ~]# lsof -i:80
COMMAND PID
USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 37010
root 7u IPv4 58530
0t0 TCP *:http (LISTEN)
nginx 37011 gitlab-www
7u IPv4 58530 0t0 TCP *:http (LISTEN)
nginx 37012 gitlab-www
7u IPv4 58530 0t0 TCP *:http (LISTEN)
nginx 37013 gitlab-www
7u IPv4 58530 0t0 TCP *:http (LISTEN)
nginx 37014 gitlab-www
7u IPv4 58530 0t0 TCP *:http (LISTEN)