1. gitlab官方安装教程(基于centos7)

https://about.gitlab.com/install/#centos-7

  1. sudo yum install -y curl policycoreutils-python openssh-server
  2. sudo systemctl enable sshd
  3. sudo systemctl start sshd
  4. sudo firewall-cmd --permanent --add-service=http
  5. sudo firewall-cmd --permanent --add-service=https
  6. sudo systemctl reload firewalld
  7. sudo yum install postfix
  8. sudo systemctl enable postfix
  9. sudo systemctl start postfix
  10. curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
  11. sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

2. 官方教程存在的问题

  • 默认安装的是gitlab-ee,不是gitlab-ce
  • gitlab卸载后重装失败

    3. gitlab-ce历史版本查看

    https://packages.gitlab.com/gitlab/gitlab-ce
    image.png

    3-1. 自定义gitlab版本安装

    1. sudo yum install -y curl policycoreutils-python openssh-server
    2. sudo systemctl enable sshd
    3. sudo systemctl start sshd
    4. sudo firewall-cmd --permanent --add-service=http
    5. sudo firewall-cmd --permanent --add-service=https
    6. sudo systemctl reload firewalld
    7. sudo yum install postfix
    8. sudo systemctl enable postfix
    9. sudo systemctl start postfix
    10. wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-13.6.3-ce.0.el7.x86_64.rpm/download.rpm
    11. yum install -y gitlab-ce

image.png

4. 配置端口, 访问路径

gitlab默认端口是80和8080, 外界访问80端口,由nginx转发到8080端口访问gitlab
由于80端口和8080端口基本上都是要用到其他地方的, 所以这里需要调整gitlab的默认端口

  1. # 修改gitlab.rb文件
  2. vi /etc/gitlab/gitlab.rb

image.png
external_url 我这里配的是域名,没有域名的直接配置IP就行
nginx[‘listen_port’] 修改默认的80端口为1081端口
unicorn[‘port’] 修改默认的8080端口为9126端口

5. 重启gitlab

  1. gitlab-ctl stop
  2. gitlab-ctl reconfigure
  3. gitlab-ctl start