CentOS安装gitLab服务器

率先应用gitlab-install-el6.sh安装,比较简单:

        统筹场景:

(出处:http://www.linuxidc.com/Linux/2013-06/85754.htm)

      当自己连手 企讯在线 (www.qx-zx.com)
的时刻,确实发难矣,因为还要要还之前自己在做 “亿网世界”
和“印刷在线”网站时的麻烦工作,那就算是编用户注册页面的求证代码…

1:如果生极,提供相同雅新的Server,仅仅只是设置了有些系统的软件包,可以一直行使一键安之下面本来搭建,非常容易,具体步骤如下:
2.1.1 安装EPEL扩展源
切换到root用户

     
这实在是一个不胜不好之政工,即使你可以从之前的网站呈现那些代码拷贝进来,但是修改工作仍会令而犯狂…

1 $ sudo -i
2 # rpm -ivh http://fr2.rpmfind.net/linux/epel/6/x86_64/epel-release-6-8.noarch.rpm

      所以,我花费了点时将说明做成一个jQuery插件…

2: 安装git

     

1 # yum install git

     设计目标:成立一个基于jQuery框架的通用Web验证插件…

3:下载gitlab-installer.sh安装脚本

      

1 # git clone https://github.com/mattias-ohlsson/gitlab-installer.git

     设计要求:1.亟需美的css样式及小图标的润饰…

4:执行安装脚本

                   2.基于jQuery框架…

1 # cd gitlab-installer/
2 # ./gitlab-install-el6.sh

                   3.调用.net Web 服务来贯彻与数据库的异步交互…

候脚本执行完毕后,会提示如下信(比如Server主机名吧:heydevops-node-2):

 

 1 ### Done ########################################
 2 #
 3 # You have your MySQL root password in this file:
 4 # /config/database.yml
 5 #
 6 # Point your browser to:
 7 # http://heydevops-node-2 (or: http://[host-ip])
 8 # Default admin username: admin@local.host
 9 # Default admin password: 5iveL!fe
10 #
11 #################################################

     釜底抽薪方案:1、首先,我们来设计三个像样,分别用来显示Web给用户的视觉感知。它们各自是

5:将脚本的Ruby版本指向到ruby-1.9.3-p392

                        .msg_warning{font-family:Arial,Helvetica,sans-serif,simsun;
background:#e7f7ff url(register/MsgWarning.gif) no-repeat;border:solid
1px #6cf;color:#333;padding:0 0 0 36px !important;width:220px;
margin-left:20px;}

# vim /home/git/gitlab-shell/bin/gitlab-shell

#!/usr/local/rvm/bin/ruby-1.9.3-p392

                        
.msg_error{font-family:Arial,Helvetica,sans-serif,simsun;background:#fff3ef
url(register/MsgError.jpg) no-repeat;border:solid 1px
#ff6610;color:#333;padding:0 0 0 36px !important;width:220px; 
margin-left:20px;}

6:使用GitLab

                         .msg_ok{font-family:Arial,Helvetica,sans-serif,simsun;background:#e7ffe7
url(register/MsgOk.gif) no-repeat;border:solid 1px
#95e895;color:#333;padding:0 0 0 36px !important;width:220px; 
margin-left:20px;}

继之,就可由此 http://\[host-ip\]
([host-ip]是Server的IP)来访问GitHub了。

      分别是证明错误,验证警告及说明正确时候的两样样式…


         2.
每当对应的职务放置图片,如样式中的所示,包含MsgWarning.gif,MsgError.jpg,MsgOk.gif三摆设小图分别对应.msg_warning;.msg_error;.msg_ok;

脚是编译安装:

 

(出处:http://www.bkjia.com/Linux/1031587.html?qqdrsign=05096)

3.初步编制脚本

先是申明此文档是依据别人的设置步骤及开展修改的!解决了点的很多问题。

(1)、//去丢空值
String.prototype.trim = function()
{
    var x = this;
    x = x.replace(/^\s*(.*)/, “$1”);
    return x;
}

参考资料:http://www.01happy.com/centos-6-5-install-gitlab/

以此函数用以去丢文本框中的空位置(trim)…

GitLab,是一个运用
Ruby on Rails
开发之开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在集体里以。

 


方只供了Debian/Ubuntu系统下之安说明文档,如果急需在centos下安装,可以参见这篇:https://github.com
/gitlabhq/gitlab-recipes/tree/master/install/centos,笔者按照当时首文章的辨证,成功的以
centos系统及设置了gitlab,分享一下自己的安装过程与遇的题材。

(2)、写点儿个数组,用以存放点验证时的唤醒语句和样式…

安的英文文档:centos-6-5-install-gitlab.zip

var ErrorWords = [‘正确!’, ‘不克也空!’,
‘E-mail地址长度不能够跳50各类!’,
‘请输入正确的信箱格式!’,”密码要充分被6个,少于16单!”,”密钥不放对!”,’公司称不克超过50位!’,”区号和号码都不呢空!”,”区号为4各类数字!”,”号码吧7-10位之数字!”,”QQ号码为5-12号数字!”,’地址长度不越50各类!’,’名字为10各项以内的华语!’,’手机号为11个数字!’,’邮编为6员数字!’,’用户名为3-15位之间!’,’域名格式错误!’,’该用户称就登记!’,’该邮筒都让注册!’]

先期秀下安装到位后底果实。

var ErrorClass = [‘msg_ok’, ‘msg_warning’, ‘msg_warning’,
‘msg_error’, ‘msg_warning’, ‘msg_error’, ‘msg_warning’,
‘msg_warning’,
‘msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’,’msg_error’]

centos安装gitlab成果

 

初步前

(3)、开始修各种证明类型,我写了有自能够想到的…


开始之前要预查看官方的刚需文档:https://github.com/gitlabhq/gitlabhq/blob/master/doc
/install/requirements.md
,该文档说明了网,软件及硬件等各方面的需求。详细的了解这些,可以免碰到很多怪异的题材。

;(function($){     
     //闭包邮箱核对  
     jQuery.fn.extend({                      
          “checkEmail”:function()  //封装成checkEmail()函数
           {
              $(this).blur(function(){
               var check;               
               var email=$(this).val().toLowerCase();
               var strSuffix =
“cc|com|edu|gov|int|net|org|biz|info|pro|name|coop|al|dz|af|ar|ae|aw|om|az|eg|et|ie|ee|ad|ao|ai|ag|at|au|mo|bb|pg|bs|pk|py|ps|bh|pa|br|by|bm|bg|mp|bj|be|is|pr|ba|pl|bo|bz|bw|bt|bf|bi|bv|kp|gq|dk|de|tl|tp|tg|dm|do|ru|ec|er|fr|fo|pf|gf|tf|va|ph|fj|fi|cv|fk|gm|cg|cd|co|cr|gg|gd|gl|ge|cu|gp|gu|gy|kz|ht|kr|nl|an|hm|hn|ki|dj|kg|gn|gw|ca|gh|ga|kh|cz|zw|cm|qa|ky|km|ci|kw|cc|hr|ke|ck|lv|ls|la|lb|lt|lr|ly|li|re|lu|rw|ro|mg|im|mv|mt|mw|my|ml|mk|mh|mq|yt|mu|mr|us|um|as|vi|mn|ms|bd|pe|fm|mm|md|ma|mc|mz|mx|nr|np|ni|ne|ng|nu|no|nf|na|za|aq|gs|eu|pw|pn|pt|jp|se|ch|sv|ws|yu|sl|sn|cy|sc|sa|cx|st|sh|kn|lc|sm|pm|vc|lk|sk|si|sj|sz|sd|sr|sb|so|tj|tw|th|tz|to|tc|tt|tn|tv|tr|tm|tk|wf|vu|gt|ve|bn|ug|ua|uy|uz|es|eh|gr|hk|sg|nc|nz|hu|sy|jm|am|ac|ye|iq|ir|il|it|in|id|uk|vg|io|jo|vn|zm|je|td|gi|cl|cf|cn”;
               var regu =
“^[a-z0-9][_a-z0-9\-]*([\.][_a-z0-9\-]+)*@([a-z0-9\-_]+[\.])+(“

安装步骤总览

  • strSuffix + “)$”;
                   var re = new RegExp(regu);
                   if(email.trim()==”) check=1;
                   else if(email.length > 50) check=2;
                   else if(email.search(re) == -1) check=3;
                   else { check=0;} 
                   $(this).next().remove(“span”);
                   $(this).after(“<span
    class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
                   })             
                }           
            })
  • 基本功操作系统(CentOS
    6.4 Minimal,升级后也6.5)
  • Ruby
    (版本: 2.0.0p353)
  • 创项目运行用户(创建git账号,方便权限管理)
  • GitLab
    Shell(版本:1.8.0)
  • 数据库(可以支撑mysql和PostgreSQL,这里运用mysql,版本:5.1.17)
  • GitLab(版本:6.3.1)
  • Web服务器(可支撑nginx和apache,这里以nginx,版本:1.0.15)
  • 防火墙(iptables)

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

1、安装操作系统

     //闭包密码验证s   
     jQuery.fn.extend({                      
          “checkCode”:function()
           {
              $(this).blur(function(){               
               var check;               
               var pwd=$(this).val();
               var path = /^[a-zA-Z0-9_]{6,16}$/;
               if(pwd.trim()==”) check=1;
               else if(!path.test(pwd)) check=4;
               else check=0;                     
              
               $(this).next().remove(“span”);
               $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
               })
            }           
        })        
        
     //闭包密码重对  
     jQuery.fn.extend({                      
          “checkCode2”:function(pwd)
           {
              $(this).blur(function(){
              
               var check;               
               var pwd2=$(this).val();
               if(pwd2.trim()==”) check=1;
               else if(pwd2!=$(pwd).val()) check=5;
               else check=0;
               $(this).next().remove(“span”);
               $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
               })
            }           
        })

此比较简单,安装完成以后记之配备下网,使其可以于启动时自动连续。而继需要提升系统和安装有遥相呼应的软件以及凭借包,以下逐一说明。

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

Tips:如果无克连国外的纱,经常出现网络错误或couldn’t
notresolve host这样的谬误,建议修改dns服务器也8.8.8.8及8.8.4.4。

     //闭包公司称核对 
     jQuery.fn.extend({                      
          “checkCPName”:function()
           {
              $(this).blur(function(){
                            
               var check;               
               var CPName=$(this).val();
               if(CPName.trim()==”) check=1;
               else if(CPName.length>50) check=6;
               else check=0;
               $(this).next().remove(“span”);
               $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
               })
            }           
        })

a、升级操作系统和安wget

 

1 $ sudo yum -y update
2 $ sudo yum -y install wget

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

晋级成功后,系统版本是6.5。

 

笔者注:和英文文档不同,笔者这里是先晋级系统及安wget,不然后面的操作会提示wget命令找到。

     //闭包公司电话/传真核对 
     jQuery.fn.extend({                      
          “checkTel”:function()
           {
              $(this).blur(function(){       
               var check;      
               var names=$(this).attr(“name”);              
               var check1=$(“input[name='”+names+”‘]”).eq(0).val();
               var check2=$(“input[name='”+names+”‘]”).eq(1).val();
               var path1 = /^[0-9]{4}$/;
               var path2= /^[0-9]{7,10}$/;
               if(check1.trim() == ”|| check2.trim()==”) check=7;
               else if(!path1.test(check1)) check=8;
               else if(!path2.test(check2)) check=9;
               else check=0;
              
$(“input[name='”+names+”‘]”).eq(1).next().remove(“span”);
               $(“input[name='”+names+”‘]”).eq(1).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
               })
            }           
        })

b、增加EPEL安装源

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

EPEL,即Extra Packages for Enterprise
Linux,这个软件仓库里发出成百上千很常用的软件,而且是特地对RHEL设计之,对RHEL标准yum源是一个挺好的补充,完全免费使用,由
Fedora项目维护,所以如果你使用的是RHEL,或者CentOS,Scientific等RHEL系的linux,可以好放心的施用EPEL的
yum源。

    //闭包QQ/MSN核对
     jQuery.fn.extend({                      
          “checkQQ”:function()
           {
              $(this).blur(function(){               
               var check;
               var CPQQ=$(this).val();
               var path= /^[0-9]{5,12}$/;
              if(CPQQ.trim()==”) check=1;
              else if(!path.test(CPQQ)) check=10;
              else check=0;
              $(this).next().remove(“span”);              
              $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
             
              })
            }           
        })

下载并设置GPG key

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

1 $ sudo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6https://www.fedoraproject.org/static/0608B895.txt
2 
3 $ sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

     //闭包地址按
     jQuery.fn.extend({                      
          “checkAdd”:function()
           {
              $(this).blur(function(){               
               var check;
               var CPAdd=$(this).val();
               if(CPAdd.trim()==”) check=1;
               else if(CPAdd.length>50) check=11;
               else check=0;
              
              $(this).next().remove(“span”);              
              $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
             
              })
            }           
        })

检察下是否安装成功

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

$ sudo rpm -qa gpg*

        //闭包用户实际姓名核对     利用函数返回程序结果
        jQuery.fn.extend({
             “checkRealName”:function()
             {
                 var check;
                $(this).blur(function(){
                  
                   var realName=$(this).val();
                   var reg =
/^[\u4e00-\u9fa5]{1,10}$/gi;                  
                   if(realName.trim()==”) check=1;
                   else if(!reg.test(realName)) check=12;
                   else check=0;
                  
                   $(this).next().remove(“span”);              
                   $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);   
                     return check;                    
                })                
             }             
        })

安装epel-release-6-8.noarch包

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

1 $ sudo rpm -Uvhhttp://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

       //闭包手机号码核对
       jQuery.fn.extend({
          “checkPhone”:function()
          {
             $(this).blur(function(){
                var check;
                var telephone=$(this).val();
                var reg=/^[0-9]{11}$/;
                if(telephone.trim()==”) check=1;
                else if(!reg.test(telephone)) check=13;
                else check=0;
               
                $(this).next().remove(“span”);              
                $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
             })
          }       
       })

提示:不要在意x86_64,在i686的机及同样会应用。

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

c、增加PUIAS安装源

      //闭包邮编核对
      jQuery.fn.extend({
         “checkPCode”:function()
         {
            $(this).blur(function(){
               var check;
               var PCode=$(this).val();
               var reg=/^[0-9]{6}$/;
               if(PCode==”) check=1;
               else if(!reg.test(PCode)) check=14;
               else check=0;
              
                $(this).next().remove(“span”);              
                $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);                
            })            
         }
      })

PUIAS Linux是面向桌面以及服务器的完好的操作系统,它凭借编译Red HatEnterprise
Linux的源代码包来创建。除了这些上游的软件包外,该项目还提供一些别的软件仓库:“Addons”包含了普通的Red
Hat发行中不入账的额外软件包,“Computational”提供专门对科学计算的软件,“Unsupported”则收入各种各样的测试性软件
包。该发行是因为美国普林斯顿 大学的高等研究所维护。

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

创建/etc/yum.repos.d/PUIAS_6_computational.repo,并丰富如下内容:

 

[PUIAS_6_computational]
name=PUIAS computational Base $releasever -$basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias

        //闭包用户称对
      jQuery.fn.extend({
          “checkUserName”:function()
          {
             $(this).blur(function(){
                var check;
                var UserName=$(this).val();
                if(UserName==”) check=1;
                else if(UserName.length<3 || UserName.length>15)
check=15;
                else check=0;
               
                $(this).next().remove(“span”);              
                $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);  
             })             
          }        
      })

下载并安装GPG key

 

1 $ sudo wget -O/etc/pki/rpm-gpg/RPM-GPG-KEY-puiashttp://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias
2 
3 $ sudo rpm --import/etc/pki/rpm-gpg/RPM-GPG-KEY-puias

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

检查下是否安装成功

 

1 $ sudo rpm -qa gpg*

      //闭包域名验证
      jQuery.fn.extend({
         “checkSite”:function()
         {                     
              $(this).blur(function(){                   
                    var check;
                    var WebSite=$(this).val();
                    var reg=
/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
                    if(WebSite==”) check=1;
                    else if(!reg.test(WebSite)) check=16;
                    else check=0;
                   
                $(this).next().remove(“span”);
                $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);               
            })        
         }
      }) 

Tips:安装完EPEL和PUIAS两个源后,可以检测下:

 

1 $ sudo yum repolist

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

d、安装GitLab的所急需依赖包及工具

    //验证用户称是否在数据库中(调用WebService方法)
    jQuery.fn.extend({
        “nameAjax”:function(LName,Lfun)
        {
           $(this).blur(function(){
              var check;
              var thisid=$(this).attr(“id”);
              var logname=$(this).val();
              if(logname==”)
              {
                   check=1;
                   $(“#”+thisid).next().remove(“span”);
                   $(“#”+thisid).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
              }
             
              else if(logname.length<3||logname.length>15)
                     {                     
                       check=15;
                       $(this).next().remove(“span”);
                       $(this).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
                     }
              else
              {

1 $ su -
2 
3 $ yum -y groupinstall 'Development Tools'
4 
5 $ yum -y install vim-enhanced readlinereadline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-develcurl-devel expat-devel db4-devel byacc sqlite-devel gcc-c++ libyamllibyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devellibicu libicu-devel system-config-firewall-tui python-devel redis sudo wgetcrontabs logwatch logrotate perl-Time-HiRes git

             $.ajax({
                type: “POST”,
                contentType:”application/json;utf-8″,
                url: “./WebService.asmx/”+LName,
                data:”{“+Lfun+”:'”+logname+”‘}”,
                dataType: ‘json’,
                anysc:false,
                success:function(data)
                {   if(data.d) check=17;                   
                    else check=0;
                                       
                    $(“#”+thisid).next().remove(“span”);
                    $(“#”+thisid).after(“<span
class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);  
                }
              })              
            }                      
           })
        }
    })

RHEL提示
若果有的管不能够安装,例如: eg. gdbm-devel, libffi-devel
andlibicu-devel,那么长rhel6的安装源。

 

1 $ yum-config-manager --enablerhel-6-server-optional-rpms

相互之间对应之Web服务方式:

e、配置redis

    /// <summary>
    ///这边核查登陆名为是否有,这边偷懒用随意验证
    /// </summary>
    /// <param name=”logName”></param>
    /// <returns></returns>
    [WebMethod]
    public bool checkLogoName(string lognames)
    {
        Random r = new Random();
        int i = r.Next(1, 10000);
        if (i % 2 == 0) return true;
        return false;
    }

布redis使该以开机时起步:

=========================================================================================
      //验证用户邮箱是否以数据库中(调用Web服务的艺术
     jQuery.fn.extend({   
         “emailAjax”:function(Lemail,Lfun)
         {
           $(this).blur(function(){
                 var check;
                 var thisid=$(this).attr(“id”);             
               
              var email=$(this).val().toLowerCase();
               var strSuffix =
“cc|com|edu|gov|int|net|org|biz|info|pro|name|coop|al|dz|af|ar|ae|aw|om|az|eg|et|ie|ee|ad|ao|ai|ag|at|au|mo|bb|pg|bs|pk|py|ps|bh|pa|br|by|bm|bg|mp|bj|be|is|pr|ba|pl|bo|bz|bw|bt|bf|bi|bv|kp|gq|dk|de|tl|tp|tg|dm|do|ru|ec|er|fr|fo|pf|gf|tf|va|ph|fj|fi|cv|fk|gm|cg|cd|co|cr|gg|gd|gl|ge|cu|gp|gu|gy|kz|ht|kr|nl|an|hm|hn|ki|dj|kg|gn|gw|ca|gh|ga|kh|cz|zw|cm|qa|ky|km|ci|kw|cc|hr|ke|ck|lv|ls|la|lb|lt|lr|ly|li|re|lu|rw|ro|mg|im|mv|mt|mw|my|ml|mk|mh|mq|yt|mu|mr|us|um|as|vi|mn|ms|bd|pe|fm|mm|md|ma|mc|mz|mx|nr|np|ni|ne|ng|nu|no|nf|na|za|aq|gs|eu|pw|pn|pt|jp|se|ch|sv|ws|yu|sl|sn|cy|sc|sa|cx|st|sh|kn|lc|sm|pm|vc|lk|sk|si|sj|sz|sd|sr|sb|so|tj|tw|th|tz|to|tc|tt|tn|tv|tr|tm|tk|wf|vu|gt|ve|bn|ug|ua|uy|uz|es|eh|gr|hk|sg|nc|nz|hu|sy|jm|am|ac|ye|iq|ir|il|it|in|id|uk|vg|io|jo|vn|zm|je|td|gi|cl|cf|cn”;
               var regu =
“^[a-z0-9][_a-z0-9\-]*([\.][_a-z0-9\-]+)*@([a-z0-9\-_]+[\.])+(“

1 $ sudo chkconfig redis on
2 $ sudo service redis start
  • strSuffix + “)$”;
                   var re = new RegExp(regu);
                   if(email.trim()==”) {
    check=1;$(this).next().remove(“span”); $(this).after(“<span
    class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
    }
                   else if(email.length > 50) { check=2;
    $(this).next().remove(“span”); $(this).after(“<span
    class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
    }
                   else if(email.search(re) == -1) { check=3;
    $(this).next().remove(“span”); $(this).after(“<span
    class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);
    }
                   else
                   {
                  
                    $.ajax({
                    type: “POST”,
                    contentType:”application/json;utf-8″,
                    url: “./WebService.asmx/”+Lemail,
                    data:”{“+Lfun+”:'”+email+”‘}”,
                    dataType: ‘json’,
                    anysc:false,
                    success:function(data)
                    {   if(data.d) check=18;                   
                        else check=0;
                                           
                        $(“#”+thisid).next().remove(“span”);
                        $(“#”+thisid).after(“<span
    class='”+ErrorClass[check]+”‘>”+ErrorWords[check]+”</span>”);  
                    }
                  })
                   }         
               })
             }       
         })

f、配置邮件服务器

 

作者注:这个历程笔者没有配置,请参考英文文档。

交互呼应的Web服务措施:

2、安装Ruby

    /// <summary>
    /// 核对邮箱是否是,这边偷懒用随意验证
    /// </summary>
    /// <param name=”logemail”></param>
    /// <returns></returns>
    [WebMethod]
    public bool checkLogEmail(string logemails)
    {
        Random r = new Random();
        int i = r.Next(1, 10000);
        if (i % 2 == 0) return true;
        return false;
    }

下载并编译:

 

 1 $ su -
 2 
 3 $ mkdir /tmp/ruby && cd /tmp/ruby
 4 
 5 $ curl --progressftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz
 6 
 7 $ cd ruby-2.0.0-p353
 8 
 9 $ ./configure --prefix=/usr/local/
10 
11 $ make && make install

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

安到位后,重新登录终端确保$PATH生效,检测ruby的设置成功为:

    //最终交由

1 $ su -
2 
3 $ which ruby
4 
5 输出:/usr/local/bin/ruby
6 
7 $ ruby -v
8 
9 输出:ruby2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]

     jQuery.fn.extend({           
           “toReg”:function(num)
//这里的nun请留心,启用多少只证明就描写多少数字,因为自身用地方的15独说明都启用…
           {
              $(this).click(function(){              
                  var erolen=$(“.msg_error”).length;
                  var warlen=$(“.msg_warning”).length;
                  var oklen=$(“.msg_ok”).length; 
       if(oklen==num)
           {  alert(“验证通过…”); }         
         else
alert(“错误:”+erolen+”,警告:”+warlen+”,通过:”+oklen+”,请完填写信息!”);                   
              }) 
           }        
     })                   
 })(jQuery);

安装bundle:

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

1 $ sudo gem install bundler --no-ri --no-rdoc

4、在Web页面引入脚本

1.万一提示sudo: gem: command not found,使用root账号登录执行该令即可。

<script src=”jQueryValidation/js/jquery-1.4.2.min.js”
type=”text/javascript”></script>
 <script src=”jQueryValidation/js/wzh.Register.js”
type=”text/javascript”></script>   
 

2.要TM的还失败:用以下命令切换下载源,切换成后再实行$ gem install
bundler –no-ri –no-rdoc

     <script type=”text/javascript”>
       $(document).ready(function(){
      
                 $(“#Emails”).checkEmail();//验证Email
                 $(“#Codes”).checkCode();//验证密码框一
                
$(“#Codes2”).checkCode2(“#Codes”);//验证密码框二,参数为第一个密码框的ID
                 $(“#CPNames”).checkCPName();//验证公司称
                
$(“input[name=’tel’]”).checkTel();//验证电话(格式:区号框和编号框需在和一个name下面,如tel)
                
$(“input[name=’fax’]”).checkTel();//验证传真(格式:区号框和编号框需在跟一个name下面,如tel)
                 $(“#QQs”).checkQQ();//验证QQ号码
                 $(“#CPAdds”).checkAdd();//验证公司地址
                
$(“#RealName”).checkRealName();//验证真实姓名,10号中的汉语
                 $(“#Phones”).checkPhone();//验证移动电话号码,11各
                 $(“#PCodes”).checkPCode();//验证邮编 ,6员
                 $(“#UserName”).checkUserName();//验证用户称
                 $(“#WebSites”).checkSite();//验证网址
                
$(“#usernameAjax”).nameAjax(“checkLogoName”,”lognames”);//Web服务被之函数名叫,参数名叫;方法在WebService中
                
$(“#uemailAjax”).emailAjax(“checkLogEmail”,”logemails”);//Web服务受到的函数叫,参数叫;方法以WebService中

1 $ gem sources --remove https://rubygems.org/
2 
3 $ gem sources -a http://ruby.taobao.org/
4 
5 $ gem sources -l

                 
                 $(“#register”).toReg(15);//用户注册
       })
   </script>  

3、系统用户

 

创造用户git

5.Web页面的HTML源码

1 $ su -
2 
3 $ adduser --system --shell /bin/bash --comment'GitLab' --create-home --home-dir /home/git/ git

    <div>
   
       用户登录名对:<input type=”text” id=”UserName” /><br
/><br />
    邮箱核对:<input type=”text” id=”Emails”/><br /><br
/>
    密码核对:<input type=”password” id=”Codes”/><br
/><br />
    密码再对:<input type=”password” id=”Codes2″/><br
/><br />
    公司名称按:<input type=”text” id=”CPNames”/><br
/><br />
    电话:区号:<input name=”tel” type=”text” id=”txtTel1″
size=”8″/>
                –
               <input name=”tel” type=”text” id=”txtTel2″ 
size=”16″/>
               <br /><br />
    传真:区号:<input name=”fax” type=”text” id=”txtFax1″ size=”8″
/>
                –
               <input name=”fax” type=”text” id=”txtFax2″  size=”16″ 
/> <br /><br />
    用户QQ:<input type=”text” id=”QQs”/><br /><br
/>
    公司地址:<input type=”text” id=”CPAdds”/><br /><br
/>
    用户真正姓名:<input type=”text” id=”RealName”/><br
/><br />
    手机号码核对:<input type=”text” id=”Phones”/><br
/><br />
    邮编核对:<input type=”text” id=”PCodes”/><br /><br
/>
    域名验证:<input type=”text” id=”WebSites”
value=”htp://”/><br /><br />
    (数据库)用户名验证:<input type=”text”
id=”usernameAjax”/><br /><br /> 
    (数据库)用户邮箱验证:<input type=”text”
id=”uemailAjax”/><br /><br />
       <input type=”button” value=”提交” id=”register”/>
   
    </div>

以git用户不欲报到,所以这里不待装git的密码。

//至此全部完毕

转折所有邮件

 

笔者注:因为上面没有配备发送邮件,这里为略。

筹小结:还有特别无不周全之地方,譬如未想到的辨证,还有代码冗余度过大,希望用的时刻可以好改良下…

4、配置GitLab shell

可参见我开过的51印刷网的报页面,我哪怕是运用这写法的(http://www.51ysw.com/Register.html)…

GitLab shell是特别为GitLab开发之供ssh访问与本管理的软件。

 源代码下载地址(http://files.cnblogs.com/wzh2010/jqueryRegister.rar)

事先下root登录,而后切换成git

 

1 $ su -
2 
3 $ su - git

克隆gitlab shell

1 $ git clonehttps://github.com/gitlabhq/gitlab-shell.git
2 
3 $ cd gitlab-shell

切换成1.8.0本,并编辑配置

1 $ git checkout v1.8.0
2 
3 $ cp config.yml.example config.yml

这边太重大之是以gitlab_url修改成gitlab的拜访域名。形如:http://test.gitlab.com/


者注:如果gitlab是运用https访问,则需要以http替换成https,配置文件中之self_signed_cert要修改成
true,否则gitlab
shell在经api和gitlab进行通信的当儿就见面冒出错误,导致品种push出错。因为后面配置web服务器的时是采取ssl,所以这边而论
ssl的艺术配置。

Tips:
另外要采取的域名是测试域名,不要遗忘在系的/etc/hosts做域名映射。如图:

安有得之目及文书

1 $ ./bin/install

5、安装数据库

笔者这里以的是msyql,关于PostgreSQL的装置请参见原文档。

装mysql并设置开机启动:

1 $ su -
2 
3 $ yum install -y mysql-server mysql-devel
4 
5 $ chkconfig mysqld on
6 
7 $ service mysqld start

若果开行失败:解决方案如下:

如果是权力问题,则先行改权限 #chown -R mysql:mysql /var/lib/mysql

装mysql root账号的密码:

1 $ /usr/bin/mysql_secure_installation

创造新用户与数据库让gitlab使用

# 登录数据库

1 $ mysql -u root -p

# 输入root密码

# 为gitlab创建以用户

1 CREATE USER 'gitlab'@'localhost' IDENTIFIED BY'gitlab账号的密码';

# 创建gitlaba使用的数据库

1 CREATE DATABASE IF NOT EXISTS`gitlabhq_production` DEFAULT CHARACTERSET `utf8`COLLATE`utf8_unicode_ci`;

# 给予gitlab用户权限

1 GRANT SELECT, LOCK TABLES, INSERT, UPDATE,DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO'gitlab'@'localhost';

# 登出数据库

1 \q

6、安装GitLab

用GitLab安装在git的家目录下:

1 $ su -
2 
3 $ su - git

a、克隆GitLab并切换分支到6-3-stable

# 克隆GitLab

1 $ git clonehttps://github.com/gitlabhq/gitlabhq.git gitlab

# 进入gitlab目录

1 $ cd /home/git/gitlab

# 切换到6-3-stable分支

$ git checkout 6-3-stable

b、配置项目

# 复制配置文件

1 $ cp config/gitlab.yml.exampleconfig/gitlab.yml

# 修改配置文件被的看域名

(your_domain_name为品种之顾域名)

1 $ sed -i 's|localhost|your_domain_name|g'config/gitlab.yml

修改后呢:

注意:host:172.16.9.120;port:8888 email_from:email@email.com

# 设定log和tmp目录所有者同权杖

1 $ chown -R git log/
2 
3 $ chown -R git tmp/
4 
5 $ chmod -R u+rwX log/
6 
7 $ chmod -R u+rwX tmp/

# 创建gitlab-satellites目录

1 $ mkdir /home/git/gitlab-satellites

# 创建tmp/pids/和tmp/sockets/目录,确保gitlab有相应的权杖

1 $ mkdir tmp/pids/
2 
3 $ mkdir tmp/sockets/
4 
5 $ chmod -R u+rwX tmp/pids/
6 
7 $ chmod -R u+rwX tmp/sockets/

# 创建public/uploads目录

1 $ mkdir public/uploads
2 
3 $ chmod -R u+rwX public/uploads

# 复制unicorn配置

1 $ cp config/unicorn.rb.exampleconfig/unicorn.rb

# 编辑unicorn配置

(笔者这里以默认配置)

1 $ vim config/unicorn.rb

修改后呢:

# 配置git的用户与邮件

1 $ git config --global user.name"GitLab"
2 
3 $ git config --global user.email"gitlab@your_domain_name"
4 
5 $ git config --global core.autocrlf input

及时边的配置比较复杂,细心些就实施了。

c、配置数据库访问文件

1 $ cp config/database.yml.mysqlconfig/database.yml

编排config/database.yml,设置中连接数据库的账号密码,笔者的布局有如下:

 1 #
 2 
 3 # PRODUCTION
 4 
 5 #
 6 
 7 production:
 8 
 9 adapter: mysql2
10 
11 encoding: utf8
12 
13 reconnect: false
14 
15 database:gitlabhq_production
16 
17 pool: 10
18 
19 username: gitlab
20 
21 password:"gitlab"
22 
23 # host: localhost
24 
25 # socket:/tmp/mysql.sock

修改中username和password就可了,其中密码就是点数据库步骤中开创gitlab用户之密码。

保证该文件只来git账号有权力读取。

1 $ chmod o-rwx config/database.yml

d、安装Gems

1 $ su -
2 
3 $ gem install charlock_holmes --version'0.6.9.4'
4 
5 $ exit

安装mysql包

1 $ cd /home/git/gitlab/
2 
3 $ bundle install --deployment --withoutdevelopment test postgres puma aws

1.如履行破产:处理方法:

参考网址:http://www.myexception.cn/open-source/1739499.html

2.而TM的还失败,提示mysql2-0.3.11下蛋载&安装失败,解决方案如下:

gem install mysql2 -v ‘0.3.11’

参照网址:https://ruby-china.org/topics/23280

e、初始化数据与激活高级功能

1 $ cd /home/git/gitlab
2 
3 $ bundle exec rake gitlab:setupRAILS_ENV=production

眼看步成功后,会生一个默认的管理员账号:

admin@local.host

5iveL!fe

f、安装启动脚本

1 $ su -
2 
3 $ wget -O /etc/init.d/gitlabhttps://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn
4 
5 $ chmod +x /etc/init.d/gitlab
6 
7 $ chkconfig --add gitlab

开机时起步

1 $ chkconfig gitlab on

g、检测应用程序状态

1 $ su - git
2 
3 $ cd gitlab/
4 
5 $ bundle exec rake gitlab:env:infoRAILS_ENV=production
6 
7 $ exit

可以查阅到系统、Ruby、GitLab和GitLabShell的本子和其他信息。

启动GitLab实例

1 $ service gitlab start

一旦开行失败,解决方案如下:

参考网址:http://www.01happy.com/centos-6-5-install-gitlab/(底下评论)

h、查看下更加详实的音讯

1 $ su - git
2 
3 $ cd gitlab/
4 
5 $ bundle exec rake gitlab:checkRAILS_ENV=production

此地会提醒一个Init script up-to-date的失实,如下:

 1 Init script up-to-date? ... no
 2 
 3 Try fixing it:
 4 
 5 Redownload the init script
 6 
 7 For more information see:
 8 
 9 doc/install/installation.md in section "Install InitScript"
10 
11 Please fix the error above and rerun the checks.

初稿说明并非在意者题目。

7、安装web服务器

笔者选取的凡nginx,关于apache方面的呼吁参考原文档

 1 $ su -
 2 
 3 $ yum -y install nginx
 4 
 5 $ chkconfig nginx on
 6 
 7 $ mkdir /etc/nginx/sites-available
 8 
 9 $ mkdir /etc/nginx/sites-enabled
10 
11 $ wget -O /etc/nginx/sites-available/gitlab https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/support/nginx/gitlab-ssl

在/etc/nginx/conf.d/建立gitlab.conf文件,文件内容也:见文件夹gitlab.conf文件(附件也起)

将nginx加入git用户组

1 $ usermod -a -G git nginx
2 
3 $ chmod g+rx /home/git/

加加ssl证书或者自己生成一个

1 $ cd /etc/nginx
2 
3 $ openssl req -new -x509 -nodes -days 3560-out gitlab.crt -keyout gitlab.key

启动nginx

1 $ service nginx start

8、配置防火墙

布置iptables,使用户可以拜http、https和ssh的端口。

1 $ lokkit -s http -s https -s ssh

更开动防火墙

1 $ service iptables restart

迄今为止就算安装好了。默认的账号密码:

admin@local.host

5iveL!fe

问题记录

a、网站未克填补加用户以及开创项目问题?

翻了生日志,发现凡是权力的问题:

Errno::EACCES (Permission denied –
/home/git/gitlab/log/application.log):

改用户和所属用户组为git就可了。

b、无法push?

于 上面安装GitLab
shell步骤时,一开始笔者是将布中的gitlab_url设置成http://test.gitlab.com/,结果在push的时候出错了,后
来查看GitLab项目日志,才意识GitLab
shell和GitLab通信的时刻起了一个301跨反。这点通过GitLab的nginx配置为会看的出来。后来将http替换成
https,self_signed_cert设置成true就OK了。

总结


装的过程较长,其中绝大多数光阴花在了保管的下载上。笔者以前从未有过接触过ruby,安装的长河遭到吗询问了下Ruby、Gem、Bundle等软件,
受益匪浅。一般来讲,照在地方的手续安装,如果系统,软件相当版本都如出一辙的话,应该能打响安装。如果出现问题,可以多检查日志。GitLab项目之日记在该
项目的log目录内。GitLab shell的日志在GitLab
shell项目遭到之gitlab-shell.log

附件:gitlab.conf文件内容:

  1 ## GitLab
  2 
  3 ## Contributors: randx, yin8086, sashkab, orkoden, axilleas
  4 
  5 ##
  6 
  7 ## Modified from nginx http version
  8 
  9 ## Modified fromhttp://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
 10 
 11 ## Modified fromhttps://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
 12 
 13 ##
 14 
 15 ## Lines starting with two hashes (##) are comments with information.
 16 
 17 ## Lines starting with one hash (#) are configuration parameters that canbe uncommented.
 18 
 19 ##
 20 
 21 ##################################
 22 
 23 ## CHUNKED TRANSFER ##
 24 
 25 ##################################
 26 
 27 ##
 28 
 29 ## It is a known issue that Git-over-HTTP requires chunked transferencoding [0]
 30 
 31 ## which is not supported by Nginx < 1.3.9 [1]. As a result, pushing alarge object
 32 
 33 ## with Git (i.e. a single large file) can lead to a 411 error. In theoryyou can get
 34 
 35 ## around this by tweaking this configuration file and either:
 36 
 37 ## - installing an old version of Nginx with the chunkin module [2]compiled in, or
 38 
 39 ## - using a newer version of Nginx.
 40 
 41 ##
 42 
 43 ## At the time of writing we do not know if either of these theoreticalsolutions works.
 44 
 45 ## As a workaround users can use Git over SSH to push large files.
 46 
 47 ##
 48 
 49 ## [0]https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
 50 
 51 ## [1] https://github.com/agentzh/chunkin-nginx-module#status
 52 
 53 ## [2] https://github.com/agentzh/chunkin-nginx-module
 54 
 55 ##
 56 
 57 ##
 58 
 59 ###################################
 60 
 61 ## SSL configuration ##
 62 
 63 ###################################
 64 
 65 ##
 66 
 67 ## See installation.md#using-https for additional HTTPS configurationdetails.
 68 
 69 upstream gitlab {
 70 
 71 serverunix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
 72 
 73 }
 74 
 75 ## Normal HTTP host
 76 
 77 server {
 78 
 79 listen 80;
 80 
 81 server_name 172.16.9.120; ##Replace this with something like gitlab.example.com
 82 
 83 server_tokens off; ## Don't showthe nginx version number, a security best practice
 84 
 85 ## Redirects all traffic to theHTTPS host
 86 
 87 root /nowhere; ## root doesn't have to be avalid path since we are redirecting
 88 
 89 location / {
 90 
 91 proxy_passhttp://172.16.9.120:8888;
 92 
 93 }
 94 
 95 }
 96 
 97 ## HTTPS host
 98 
 99 server {
100 
101 listen 443 ssl;
102 
103 server_name 172.16.9.120; ##Replace this with something like gitlab.example.com
104 
105 server_tokens off;
106 
107 root /home/git/gitlab/public;
108 
109 ## Increase this if you want toupload large attachments
110 
111 ## Or if you want to accept largegit objects over http
112 
113 client_max_body_size 20m;
114 
115 ## Strong SSL Security
116 
117 ##https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html &https://cipherli.st/
118 
119 ssl on;
120 
121 ssl_certificate/etc/nginx/gitlab.crt;
122 
123 ssl_certificate_key/etc/nginx/gitlab.key;
124 
125 # GitLab needs backwardscompatible ciphers to retain compatibility with Java IDEs
126 
127 ssl_ciphers"ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
128 
129 ssl_protocols TLSv1 TLSv1.1TLSv1.2;
130 
131 ssl_prefer_server_ciphers on;
132 
133 ssl_session_cache shared:SSL:10m;
134 
135 ## [WARNING] The following headerstates that the browser should only communicate
136 
137 ## with your server over a secureconnection for the next 24 months.
138 
139 add_headerStrict-Transport-Security max-age=63072000;
140 
141 add_header X-Frame-OptionsSAMEORIGIN;
142 
143 add_header X-Content-Type-Optionsnosniff;
144 
145 ## [Optional] If your certficatehas OCSP, enable OCSP stapling to reduce the overhead and latency of runningSSL.
146 
147 ## Replace with yourssl_trusted_certificate. For more info see:
148 
149 ## -https://medium.com/devops-programming/4445f4862461
150 
151 ## -https://www.ruby-forum.com/topic/4419319
152 
153 ## -https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
154 
155 # ssl_stapling on;
156 
157 # ssl_stapling_verify on;
158 
159 # ssl_trusted_certificate/etc/nginx/ssl/stapling.trusted.crt;
160 
161 # resolver 208.67.222.222 208.67.222.220valid=300s; # Can change to your DNS resolver if desired
162 
163 # resolver_timeout 5s;
164 
165 ## [Optional] Generate a strongerDHE parameter:
166 
167 ## sudo openssl dhparam -out/etc/ssl/certs/dhparam.pem 4096
168 
169 ##
170 
171 # ssl_dhparam/etc/ssl/certs/dhparam.pem;
172 
173 ## Individual nginx logs for thisGitLab vhost
174 
175 access_log /var/log/nginx/gitlab_access.log;
176 
177 error_log /var/log/nginx/gitlab_error.log;
178 
179 location / {
180 
181 ## Serve static files fromdefined root folder.
182 
183 ## @gitlab is a named locationfor the upstream fallback, see below.
184 
185 try_files $uri $uri/index.html$uri.html @gitlab;
186 
187 }
188 
189 ## If a file, which is not foundin the root folder is requested,
190 
191 ## then the proxy passes therequest to the upsteam (gitlab unicorn).
192 
193 location @gitlab {
194 
195 ## If you use HTTPS make sureyou disable gzip compression
196 
197 ## to be safe against BREACHattack.
198 
199 gzip off;
200 
201 ##https://github.com/gitlabhq/gitlabhq/issues/694
202 
203 ## Some requests take more than30 seconds.
204 
205 proxy_read_timeout 300;
206 
207 proxy_connect_timeout 300;
208 
209 proxy_redirect off;
210 
211 proxy_set_header Host $http_host;
212 
213 proxy_set_header X-Real-IP $remote_addr;
214 
215 proxy_set_header X-Forwarded-Ssl on;
216 
217 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
218 
219 proxy_set_header X-Forwarded-Proto $scheme;
220 
221 proxy_set_header X-Frame-Options SAMEORIGIN;
222 
223 proxy_passhttp://172.16.9.120:8888;
224 
225 }
226 
227 ## Enable gzip compression as perrails guide:
228 
229 ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
230 
231 ## WARNING: If you are usingrelative urls remove the block below
232 
233 ## See config/application.rb under"Relative url support" for the list of
234 
235 ## other files that need to bechanged for relative url support
236 
237 location ~ ^/(assets)/ {
238 
239 root /home/git/gitlab/public;
240 
241 gzip_static on; # to servepre-gzipped version
242 
243 expires max;
244 
245 add_header Cache-Control public;
246 
247 }
248 
249 error_page 502 /502.html;
250 
251 }