相信很多技术人员都知道有个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. tar.xz文件如何解压 (已验证)

    XZ压缩最新压缩率之王 xz这个压缩可能很多都很陌生,不过您可知道xz是绝大数linux默认就带的一个压缩工具. 之前xz使用一直很少,所以几乎没有什么提起. 我是在下载phpmyadmin的时候看到 ...

  2. 【xml 报错】xml编译错误

    ---恢复内容开始--- 有时候在xml文件中,特别是于Spring相关的配置文件中,会出现一些不影响程序正常运行的编译错误,如: Referenced file contains errors (h ...

  3. ajax的参数

    http://www.w3school.com.cn/jquery/ajax_ajax.asp call.addAllremark = function(data){ $.ajax({ url:cal ...

  4. 2015CCPC小记

    距离第一届CCPC也正好一星期了,突然想到还没写总结,现在补上.做为刚度过大一的我,能有机会去参加国赛是很激动的.周五下午出发,坐了13个小时的火车抵达南阳,南阳不算大城市,有点落后,但是这里的人很热 ...

  5. !cocos2d 重复添加action事件

    当点击的时候,如果不是按照开始点击计算的,那么持续点击会导致不会变大. void Piece::setActived(bool active) { _actived = active; CCActio ...

  6. wp ApplicationBar

    WP7中的菜单栏 一个应用程序的菜单栏的内容是有限的,最多不超过4个,排列顺序是以菜单栏中间为中心,然后从左往右排列. WP7提供了两种类型的菜单栏,一种是全局的菜单栏,也就是说在所有的页面中都会出现 ...

  7. topcoder SRM 593 DIV2 RaiseThisBarn

    #include <vector> #include <string> #include <list> #include <map> #include ...

  8. POJ 2948 Martian Mining(DP)这是POJ第200道,居然没发现

    题目链接 两种矿石,Y和B,Y只能从从右到左,B是从下到上,每个空格只能是上下或者左右,具体看图.求左端+上端最大值. 很容易发现如果想最优,分界线一定是不下降的,分界线上面全是往上,分界线下面都是往 ...

  9. winform学习之----打开文件对话框并将文件内容放入文本框

    OpenFileDialog ofg = new OpenFileDialog(); ofg.Title = "ddd";//设置对话框标题 ofg.Multiselect = t ...

  10. Geronimo应用服务器和MySQL数据库服务器

    就是Web 2.0的全部,尽管该术语出现才几乎一年的时间,但现在好像只有烹饪杂志还没有加入到讨论Web 2.0未来出路的行列中.自从出现了里程碑式的文章"What Is Web 2.0:De ...