相信很多技术人员都知道有个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. RequiredFieldValidator 控件 CompareValidator 控件

    RequiredFieldValidator 控件 验证关联控件非空 ControlToValidate 属性用来关联被验证控件 ErrorMEssage 触发控件后显示的错误信息 CompareVa ...

  2. 线段树 Codeforces Round #197 (Div. 2) D. Xenia and Bit Operations

    题目传送门 /* 线段树的单点更新:有一个交叉更新,若rank=1,or:rank=0,xor 详细解释:http://www.xuebuyuan.com/1154895.html */ #inclu ...

  3. java中的String设计原理

    首先,必须强调一点:String Pool不是在堆区,也不是在栈区,而是存在于方法区(Method Area) 解析: String Pool是常量池(Constant  Pool)中的一块. 我们知 ...

  4. BZOJ3931 [CQOI2015]网络吞吐量(最大流)

    没啥好说的,有写过类似的,就是预处理出最短路上的边建容量网络. #include<cstdio> #include<cstring> #include<queue> ...

  5. ural 1434. Buses in Vasyuki

    1434. Buses in Vasyuki Time limit: 3.0 secondMemory limit: 64 MB The Vasyuki University is holding a ...

  6. Equipment Box[HDU1110]

    Equipment Box Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  7. C++中inline这个玩意儿

    inline 说明这个函数是内联的,在编译过程中内联函数会直接被源代码替换,提高执行效率 如果类中的某个函数会被调用很多次或者放在循环中,那么建议将这个函数声明为内联,可以提高程序的运行效率

  8. Linux Mint 没有 language support 语言支持解决方案

    打开新立得软件管理器在右边找到有关语言的安装后,language support就会出现

  9. cJSON应用举例

    //在网上查了不少cJSON,结果只找到c语言字符串转换到JSON的实例,想转回来结果没有实例.自己琢磨了一个下午才敢下手.下面把转来转去的代码贴上. //百度网盘的 CJSON 实例源码 地址 ht ...

  10. ZXing二维码的生成和解析

    Zxing是Google提供的关于条码(一维码.二维码)的解析工具,提供了二维码的生成与解析的方法, 现在我简单介绍一下使用Java利用Zxing生成与解析二维码 注意: 二维码的生成需要借助辅助类( ...