官方安装文档
    https://about.gitlab.com/install/#centos-7

    博客:
    https://blog.csdn.net/musuny/article/details/78548868
    https://blog.csdn.net/girl829475l/article/details/102700027
    https://soulchild.cn/729.html

    sudo yum install -y curl policycoreutils-python openssh-server
    sudo systemctl enable sshd
    sudo systemctl start sshd
    sudo firewall-cmd —permanent —add-service=http
    sudo firewall-cmd —permanent —add-service=https
    sudo systemctl reload firewalld

    sudo yum install postfix -y
    sudo systemctl enable postfix
    sudo systemctl start postfix

    企业版过期后和社区版一样
    curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
    sudo EXTERNAL_URL=”http://192.168.31.81“ yum install -y gitlab-ee

    EXTERNAL_URL:定义仓库使用的名字:

    [root@gitlab-server yum.repos.d]# gitlab-ctl restart
    ok: run: alertmanager: (pid 7460) 0s
    ok: run: gitaly: (pid 7474) 0s
    ok: run: gitlab-exporter: (pid 7493) 1s
    ok: run: gitlab-workhorse: (pid 7510) 0s
    ok: run: grafana: (pid 7518) 1s
    ok: run: logrotate: (pid 7611) 0s
    ok: run: nginx: (pid 7617) 1s
    ok: run: node-exporter: (pid 7631) 0s
    ok: run: postgres-exporter: (pid 7638) 0s
    ok: run: postgresql: (pid 7649) 1s
    ok: run: prometheus: (pid 7658) 0s
    ok: run: redis: (pid 7671) 1s
    ok: run: redis-exporter: (pid 7676) 0s
    ok: run: sidekiq: (pid 7685) 0s
    ok: run: unicorn: (pid 7697) 1s
    [root@gitlab-server yum.repos.d]# gitlab-ctl status
    run: alertmanager: (pid 7460) 18s; run: log: (pid 6757) 212s
    run: gitaly: (pid 7474) 17s; run: log: (pid 6240) 299s
    run: gitlab-exporter: (pid 7493) 17s; run: log: (pid 6669) 230s
    run: gitlab-workhorse: (pid 7510) 16s; run: log: (pid 6479) 255s
    run: grafana: (pid 7518) 16s; run: log: (pid 6864) 192s
    run: logrotate: (pid 7611) 15s; run: log: (pid 6620) 243s
    run: nginx: (pid 7617) 15s; run: log: (pid 6553) 249s
    run: node-exporter: (pid 7631) 14s; run: log: (pid 6651) 237s
    run: postgres-exporter: (pid 7638) 14s; run: log: (pid 6799) 208s
    run: postgresql: (pid 7649) 14s; run: log: (pid 6329) 293s
    run: prometheus: (pid 7658) 13s; run: log: (pid 6726) 218s
    run: redis: (pid 7671) 13s; run: log: (pid 6093) 303s
    run: redis-exporter: (pid 7676) 12s; run: log: (pid 6696) 224s
    run: sidekiq: (pid 7685) 10s; run: log: (pid 6451) 261s
    run: unicorn: (pid 7697) 9s; run: log: (pid 6430) 267s
    [root@gitlab-server yum.repos.d]#

    [root@gitlab-server ~]#
    [root@gitlab-server ~]# netstat -lntp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 127.0.0.1:3000 0.0.0.0: LISTEN 7518/grafana-server
    tcp 0 0 0.0.0.0:8060 0.0.0.0:
    LISTEN 7617/nginx: master
    tcp 0 0 127.0.0.1:9121 0.0.0.0: LISTEN 7676/redis_exporter
    tcp 0 0 127.0.0.1:9090 0.0.0.0:
    LISTEN 7658/prometheus
    tcp 0 0 127.0.0.1:9187 0.0.0.0: LISTEN 7638/postgres_expor
    tcp 0 0 127.0.0.1:9093 0.0.0.0:
    LISTEN 7460/alertmanager
    tcp 0 0 127.0.0.1:9100 0.0.0.0: LISTEN 7631/node_exporter
    tcp 0 0 127.0.0.1:9229 0.0.0.0:
    LISTEN 7510/gitlab-workhor
    tcp 0 0 127.0.0.1:8080 0.0.0.0: LISTEN 7712/unicorn master
    tcp 0 0 0.0.0.0:80 0.0.0.0:
    LISTEN 7617/nginx: master
    tcp 0 0 127.0.0.1:9168 0.0.0.0: LISTEN 7493/puma 4.3.1.git
    tcp 0 0 127.0.0.1:8082 0.0.0.0:
    LISTEN 7685/sidekiq 5.2.7
    tcp 0 0 127.0.0.1:9236 0.0.0.0: LISTEN 7482/gitaly
    tcp 0 0 0.0.0.0:22 0.0.0.0:
    LISTEN 1058/sshd
    tcp6 0 0 :::9094 ::: LISTEN 7460/alertmanager
    tcp6 0 0 ::1:9168 :::
    LISTEN 7493/puma 4.3.1.git
    tcp6 0 0 :::22 :::* LISTEN 1058/sshd
    [root@gitlab-server ~]#

    第一次 web 界面打开后 需要修改密码 默认用户为:root

    image.png
    image.png

    覆盖原文件gitlab-rails汉化:
    #备份原文件
    cp -rp /opt/gitlab/embedded/service/gitlab-rails{,.bak_$(date +%F)}
    #将汉化包覆盖过去(\也需要敲) 记得cd 的汉化包文件夹里:

    \cp -rf ./* /opt/gitlab/embedded/service/gitlab-rails

    gitlab-ctl reconfigure
    gitlab-ctl start

    附. 常用gitlab命令
    gitlab-ctl reconfigure  // 重新应用gitlab的配置
    gitlab-ctl restart    // 重启gitlab服务
    gitlab-ctl status    // 查看gitlab运行状态
    gitlab-ctl stop     // 停止gitlab服务
    gitlab-ctl tail     // 查看gitlab运行日志

    优化:
    1、减少进程数
    修改配置文件gitlab.rb中的worker_processes:

    unicorn[‘worker_processes’] = 2
    复制代码
    默认是被注释掉的,官方建议该值是CPU核心数加一,可以提高服务器的响应速度,如果内存只有4G,或者服务器上有其它业务,就不要改了,以免内存不足。另外,这个参数最小值是2,设为1,服务器可能会卡死。

    2、减少数据库缓存
    默认为256MB,可适当改小

    postgresql[‘shared_buffers’] = “256MB”
    复制代码
    3、减少数据库并发数
    默认为8,可适当改小

    postgresql[‘max_worker_processes’] = 8
    复制代码
    4、减少sidekiq并发数
    默认是25,可适当改小

    sidekiq[‘concurrency’] = 25
    复制代码
    重启服务
    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart