zoukankan      html  css  js  c++  java
  • Gitlab的安装汉化及问题解决

    Gitlab的安装汉化及问题解决(2017/12/14目前版本为10.2.4)

    一、前言

      Gitlab需要安装的包太TM多了,源码安装能愁死个人,一直出错,后来发现几行命令就装的真是遇到的新大陆一样... ... 

       装完之后感觉太简单,加了汉化补丁,因为要用于线上环境顺手关了注册登录,保存发现关错了...作死今天上午才弄好,详情见下文

    二、安装

      可以rpm安装下载地址:清华开源网站镜像站

      或者看下图...还用写么... ...centos6版

     

      截图不好复制,我来插入一下

      

    #sudo是获取root权限的,用root用户搭就不用了
    yum install -y curl policycoreutils-python openssh-server cronie
    lokkit -s http -s ssh
    
    
    yum install postfix
    service postfix start
    chkconfig postfix on
    
    
    curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | bash
    
    
    EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ee

      官网还有ubuntu,docker等的安装方式,地址为:

    https://about.gitlab.com/installation/#centos-6
    官网地址

     

      写完上面那些就安装完成了,再来更新下配置

    #先修改个域名,改成自己的域名解析的地址,没有先不改也可以,我开始没改也没错。
    #有说改成自己本机ip的,然后出错的话在external_url和ip直接加等号(没试,用的域名)
    vim /etc/gitlab/gitlab.rb
    external_url 'http://gitlab.****.com'
    #更新配置
    gitlab-ctl reconfigure
    #查看状态
    gitlab-ctl status
    #重启 
    gitlab-ctl restart
    ok: run: gitaly: (pid 24115) 0s
    ok: run: gitlab-monitor: (pid 24131) 1s
    ok: run: gitlab-workhorse: (pid 24147) 0s
    ok: run: logrotate: (pid 24165) 1s
    ok: run: nginx: (pid 24171) 0s
    ok: run: node-exporter: (pid 24180) 1s
    ok: run: postgres-exporter: (pid 24192) 0s
    ok: run: postgresql: (pid 24211) 0s
    ok: run: prometheus: (pid 24227) 1s
    ok: run: redis: (pid 24279) 0s
    ok: run: redis-exporter: (pid 24283) 1s
    ok: run: sidekiq: (pid 24298) 0s
    ok: run: unicorn: (pid 24303) 1s
    #关闭
    gitlab-ctl stop
    #启动
    gitlab-ctl start
    #监控
    gitlab-ctl tail unicorn 监控unicorn日志
    gitlab-ctl tail
    
    

    起来之后访问自己的网站地址或者ip,首先让输入的是密码,这个是administrator管理员用户的密码,下面是我搭好的的首页,汉化了,去掉了自动注册,在下面说

    三、汉化

      Gitlab汉化需要看一下版本号

      cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

      10.2.4-ee

    1 #11.2.3汉化
    2 cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
    3 git clone https://gitlab.com/xhang/gitlab.git
    4 cd gitlab/
    5 git diff v11.2.3 v11.2.3-zh > ../v11.2.3-zh.diff
    6 gitlab-ctl stop
    7 patch -d /opt/gitlab/embedded/service/gitlab-rails/ -p1 < ../v11.2.3-zh.diff
    8 reboot
    9 gitlab-ctl status
    Gitlab v11.2.3汉化
    #这里也是多方总结
    git clone https://gitlab.com/xhang/gitlab.git
    cd gitlab/
    git fetch
    
    gitlab-ctl stop
    
    git diff origin/10-2-stable origin/10-2-stable-zh > /tmp/10.2.diff
    cd /opt/gitlab/embedded/service/gitlab-rails
    git apply /tmp/10.2.diff
    patch -d/opt/gitlab/embedded/service/gitlab-rails -p1 < 10.2.diff
    
    #这步好像可以不用,我直接打上了
    gitlab-ctl reconfigure
    #启动
    gitlab-ctl start

     

    502 哇,Gitlab 响应花费了太多时间。。。11.2.3版本的这个时候,多等等或者重启之后,再多等等

    四、Gitlab关闭自主注册

      这步要擦亮眼睛擦亮擦亮,关错了就懵逼了,比如说我,关了sign-in,关了登录功能,这功能都可以关闭也是没谁了,给个提醒啊,想改回去时候发现不能登录。。。

      继续上图:

     

    慢慢往下找,看到这个了吗,这个勾没了就没有登录了,不能登录,听说重装都不能登录哦

    这个上面一点,sign-up这个才是要关掉的,第一次关没注意,下面说下怎么解决的

    勾选之后到最后有个save保存生效

     

    如果不幸勾选错误No authentication methods configured.如图所示:

     旧版解决方法:

    gitlab-psql gitlabhq_production
    could not change directory to "/root": Permission denied
    psql (9.6.5)
    Type "help" for help.
    
    update application_settings SET signin_enabled=true;
    
    UPDATE 1
    gitlabhq_production=# q
    gitlab-ctl restart

    如果出现下面错误用新版的
    ERROR: column "signin_enabled" of relation "application_settings" does not exist
    LINE 1: update application_settings SET signin_enabled=true;

    因为这个版本还有 signup_enabled可以在数据库关掉自主注册,但是没有 signin_enabled这个了,有这个东西sign_in_text_html,可以在首页左中空白位置写内容

    新版解决方法:

    gitlab-psql gitlabhq_production
    could not change directory to "/root": Permission denied
    psql (9.6.5)
    Type "help" for help.
    
    gitlabhq_production=# update application_settings set password_authentication_enabled = true;
    UPDATE 1
    gitlabhq_production=# q
    gitlab-ctl restart
    折叠方法

    gitlab-psql gitlabhq_production
    could not change directory to "/root": Permission denied
    psql (9.6.5)
    Type "help" for help.

    gitlabhq_production=# update application_settings set password_authentication_enabled = true;
    UPDATE 1
    gitlabhq_production=# q
    gitlab-ctl restart

    五、总结

      安装gitlab除了自己眼瘸了一下没有遇到其他的错误,看有的错误是因为安装过程中端口被占用

      yum install -y lsof 

      lsof -i:80

      lsof -i:8080

    gitlab-ctl tail unicorn这个监控命令也很好用

     

     

     

     

  • 相关阅读:
    关于trunk、access以及hybrid的一些简单知识
    EasyUI 创建对话框
    EasyUI Window和Layout
    EasyUI 异步Tree
    EasyUI 创建Tree
    EasyUI Tree添加节点
    EasyUI Ajax 表单
    EasyUI Tree checkbox node
    EasyUI 表单 tree
    EasyUI DataGrid合并单元
  • 原文地址:https://www.cnblogs.com/cheng95/p/8037865.html
Copyright © 2011-2022 走看看