zoukankan      html  css  js  c++  java
  • 用GitLab搭建自己的私有GitHub

    用GitLab搭建自己的私有GitHub

    现在git是开发人员的必备技能之一,github的代码仓库管理系统目前是最好的,下面搭建私有github系统的过程。

    下载gitlab:
    官网地址:https://about.gitlab.com/install/
    Download a GitLab Omnibus package (recommended installation)

    安装gitlab:
    点击对应操作系统图标可以看到详细的安装步骤教程。

     ===============

    ubuntu
    https://about.gitlab.com/install/#ubuntu

    sudo apt-get update
    sudo apt-get install -y curl openssh-server ca-certificates

    sudo apt-get install -y postfix

    curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash


    Next, install the GitLab package. Change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

    sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee

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

    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

    安装Postfix 邮件通知功能
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix

    2. Add the GitLab package repository.
    curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

    sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

    ==============

    之后就可以直接使用浏览器访问 http://ip 登录管理

    个性化配置 和 注意事项

    使用自己的nignx:
    $ apt-get install nginx #安装nginx
    $ cd /etc/nginx/conf.d && touch gitlab-http.conf

    Nginx gitlab-http.conf 配置:

    upstream gitlab-workhorse {
    #server unix:/var/opt/gitlab/gitlab-workhorse/socket;
    server 127.0.0.1:8080;
    }

    upstream gitlab-git-http-server {
    server 127.0.0.1:8181;
    }

    server {
    listen *:80;
    server_name gitlab.guowei.com;
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    client_max_body_size 0;
    location / {
    proxy_read_timeout 300;
    proxy_connect_timeout 300;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto http;
    proxy_pass http://gitlab-workhorse;
    }

    location ~ [-/w.]+.git/ {
    proxy_read_timeout 300;
    proxy_connect_timeout 300;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://gitlab-git-http-server;
    }

    location ~ ^/[w.-]+/[w.-]+/repository/archive {
    client_max_body_size 0;
    error_page 418 = @git-http-server;
    return 418;
    }

    location @git-http-server {
    proxy_read_timeout 300;
    proxy_connect_timeout 300;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://gitlab-git-http-server;
    }

    }

    配置gitlab不使用nginx:
    $ vim /etc/gitlab/gitlab.rb
    # search nginx find nginx['enable'] = true

    # add
    nginx['enable'] = false
    gitlab_git_http_server['listen_network'] = "tcp"
    gitlab_git_http_server['listen_addr'] = "127.0.0.1:8181"
    # nginx['enable'] = true

    $ gitlab-ctl reconfigure #配置gitlab
    $ gitlab-ctl restart #重启服务


    卸载gitlab:
    # Stop gitlab and remove its supervision process
    sudo gitlab-ctl uninstall

    # Debian/Ubuntu
    sudo dpkg -r gitlab-ce

    # Redhat/Centos
    sudo rpm -e gitlab-ce

    注意事项:
    为了方便以http的方式操作git仓库,在nginx中有个8181端口的配置(对应gitlab.rb中的gitlab_git_http_server配置)

    下载仓库代码问题,有的可以下载,有的不可以下载
    主要是国外的库问题,可以配置下本地源加快下载速度和成功率

  • 相关阅读:
    mysql存储过程
    Mysql中的触发器
    快速开始、环境搭建、修改包名、新建模块、正式部署
    windows下redis下载安装
    Windows10下mysql 8.0.19 安装配置方法图文教程
    IDEA中安装SVN
    常见页面报错
    Python AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'
    如何编写一篇高质量的技术博文?学习本文的排名靠前大法
    Linux use apktool problem包体变大GLIBC2.14等问题
  • 原文地址:https://www.cnblogs.com/zdz8207/p/gitlab-about-install-github.html
Copyright © 2011-2022 走看看