GitLab 安装与入门

GitLab介绍:

  GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。 

  GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。

 

1安装依赖包

 yum install curl policycoreutils openssh-server openssh-clients postfix -y

 systemctl start postfix

 curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

 yum install -y gitlab-ce git

 

2、生成SSL证书

 mkdir -p /etc/gitlab/ssl

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

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

 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"

 openssl dhparam -out /etc/gitlab/ssl/dhparams.pem 2048

3、需改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

5gitlab默认使用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)

6、第一次登录,修改密码(默认管理员为:root)

原文地址:https://www.cnblogs.com/vincenshen/p/10466803.html