相信很多技术人员都知道有个github造福开发人员的git(分布式版本管理工具)代码管理社区,可以说现在git是开发人员的必备技能之一

本周有个朋友公司需要一个类似github的代码仓库管理系统,本人选择了gitlab(没有什么对比了,好像目前就gitlab最好了并且维护也不错了),下面就来说说搭建私有github系统的过程

  1. 服务器设备信息如下

    Ubuntu 14.04(64)
       memory:8G
       cpu:4
       disk:100G
       bandwidth:2Mbit/s
  2. 下载gitlab-ce-8.3.4.deb

    官网地址:https://about.gitlab.com/downloads/ (下载比较慢还要翻墙,下面有一个云盘下载地址)

    访问密码 1091  https://yunpan.cn/crywEZAgEK9gH
  3. 安装gitlab

    $ su root - #切换到root账号
    $ dpkg -i gitlab-ce-8.3.4.deb #安装
    $ gitlab-ctl reconfigure #配置gitlab
    $ gitlab-ctl status #查看服务
    $ gitlab-ctl restart/stop #重启或者关闭服务

之后就可以直接使用浏览器访问 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

注意事项

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

待解决问题

  • 下载仓库代码还是有些问题,有的可以下载,有的不可以下载还没有找出规律

原文地址:用GitLab搭建自己的私有GitHub
标签:github   git   gitlab   gitlab_git_http_server   nginx

智能推荐

用GitLab搭建自己的私有GitHub的更多相关文章

  1. GitLab → 搭建私有的版本控制的托管服务平台

    开心一刻 睡着正香,媳妇用力把我晃醒说:“快起来,我爸来了.” 我一下醒了,手脚熟练的把衣服一抱,滚到床底,顺便把鞋也收了进去 媳妇蹲下无奈的说:“快出来!咱俩都结婚半年了.” 我:“对哦,搞习惯了” ...

  2. Jenkins+Gitlab搭建持续集成(CI)环境

    利用Jenkins+Gitlab搭建持续集成(CI)环境 Permalink: 2013-09-08 22:04:00 by hyhx2008in intern tags: jenkins gitla ...

  3. gitlab搭建与基本使用【转】

    一.git.github.gitlab的区别Git是版本控制系统,Github是在线的基于Git的代码托管服务.GitHub是2008年由Ruby on Rails编写而成.GitHub同时提供付费账 ...

  4. GitLab → 搭建中常遇的问题与日常维护

    开心一刻 隔壁有一个80多岁的老大爷,昨天在小区的一棵树下发现一条黑色的蛇,冻僵了,大爷善心大发,就把蛇揣在了怀里,想给它一点温暖. 今天一大早看到大爷在树上挂了一个牌子,写到:不准随地大小便! 搭建 ...

  5. 转:使用 Go-Ethereum 1.7.2搭建以太坊私有链

    使用 Go-Ethereum 1.7.2搭建以太坊私有链 目录 [toc] 1.什么是Ethereum(以太坊) 以太坊(Ethereum)并不是一个机构,而是一款能够在区块链上实现智能合约.开源的底 ...

  6. GitLab搭建详细过程

    一.前提 系统:Centos 6.5 软件版本:gitlab-7.8.4 Selinux:关闭 防火墙规则:先清空(搭建好了后续自己添加相关放行规则) 二.yum源配置和相关依赖包 1.添加epel源 ...

  7. [原创] debian 9.3 搭建seafile企业私有网盘

    [原创] debian 9.3 搭建seafile企业私有网盘 需求是这样的, 个人疲惫于 "成为大伙的文件中转站" ,公司不管大大小小的文件,都要打电话过来“转个xx文件”.“帮 ...

  8. Ansible+Jenkins+Gitlab搭建及配置

    Ansible+Jenkins+Gitlab搭建及配置,已经生产环境使用,运行良好. 主机组文件里面好多ip敏感信息就不写了

  9. 搭建minima主题的github博客网站

    layout: post title: "搭建minima主题的github博客网站" date: 2019-04-20 19:20:20 +0800 --- 作者:吴甜甜 个人博 ...

随机推荐

  1. K-集合 (JXNU第二次周赛1006)set/平衡树

    K-集合 Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Submissi ...

  2. onclientclick和onclick区别

    OnClientClick是客户端脚本,一般使用javascript,在客户端,也就是IE中运行,点击后马上执行OnClick是服务器端事件处理函数,使用C#或者vb.net,在服务器端,也就是IIS ...

  3. ural 1245. Pictures

    1245. Pictures Time limit: 1.0 secondMemory limit: 64 MB Artist Ivanov (not the famous Ivanov who pa ...

  4. 操作properties文件,注意抹掉最前面的"file:"

    package com.xiewanzhi.property; import java.io.BufferedInputStream; import java.io.File; import java ...

  5. web farm 讨论引出

    关于web farm 有成功的实施的文档没 用它还不如 用nginx,简单易用. Nginx for windows的运行效果咋样 windows  iis无敌 玩nginx就不要用win系统,必须l ...

  6. hdu

    这道题因为某些位置要重复走,所以不能用标记的方法,但是为了提高效率,可以采用time[]数组和step[]数组来剪枝,很容易想到,当你从一条路劲走到(x,y)处的时间和步骤 比从另一条路劲走到(x,y ...

  7. SQL Server 收缩数据库

    //删除大量数据 /*** * * BEGIN TRANSACTION; * SELECT * INTO #keep FROM Original WHERE CreateDate > '2011 ...

  8. Wilddog - 野狗常用知识点

    https://www.wilddog.com/examples/chat-var1 https://z.wilddog.com/web/quickstart 增加或者修改替换整条数据(注意,upda ...

  9. 使用Eclipse自带的Axis1插件生成WSDL文件

    首先创建一个web工程,创建过程如下: 如果选择Apache Tomcat v5.5,Dynamic web module version最高只能选择2.4,填写完成后点击“下一步”: 填写默认输出文 ...

  10. css 细节收集

    细节1……………………………………………………………………………… 一.当文字与图片在一行,需要将文字与图片底对齐,需要这样写: <li>记住密码<img src="&qu ...