• gitlab一键安装+配置(备份+LADP认证)


    #gitlab一键安装
    #centos6 mini, GitLab社区版
    #参考官方最新文档 https://www.gitlab.com.cn/installation
    
    #关闭防火墙(略)
    ntpdate ntp6.aliyun.com ##同步时间
    #更换源
    yum -y install wget vim
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    yum -y install http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
    yum makecache #生成缓存
    
    #安装配置依赖
    yum install curl openssh-server openssh-clients postfix cronie -y
    service postfix start
    chkconfig postfix on
    lokkit -s http -s ssh
    
    # 添加GitLab仓库
    curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | bash
    yum install gitlab-ce #(自动安装最新版)
    #yum install gitlab-ce-8.8.4-ce.0.el6 #(安装指定版本)
    #下载rpm包安装
    #https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/
    #curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-XXX.rpm
    #rpm -i gitlab-ce-*.rpm
    
    vim /etc/gitlab/gitlab.rb #修改配置
    external_url 'http://192.168.18.9' #修改访问web
    gitlab_rails['backup_path'] = '/home/backup' #修改备份文件的目录
    gitlab_rails['backup_keep_time'] = 604800    #备份保存7天(604800是7天的秒数)
    
    gitlab-ctl reconfigure #载入配置
    #v8初始密码:
    Username: root 
    Password: 5iveL!fe
    #w1w1e1e1
    
    gitlab-ctl status #查看服务状态
    gitlab-rake gitlab:check SANITIZE=true --trace #检查gitlab
    gitlab-ctl reconfigure #启动服务
    gitlab-ctl stop     #停止所有 gitlab 组件
    gitlab-ctl start
    gitlab-ctl restart
    vim /etc/gitlab/gitlab.rb #修改默认的配置
    cat /opt/gitlab/embedded/service/gitlab-rails/VERSION #查看版本
    gitlab-ctl tail #查看日志
    
    ##备份
    gitlab-rake gitlab:backup:create #创建备份
    #自动备份(定时任务凌晨2点执行)
    crontab -e
    0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
    #恢复
    gitlab-ctl stop
    #BACKUP=xxxxxx ,为备份文件前面的数字部分
    cd /var/opt/gitlab/backups # 默认备份存放目录
    gitlab-rake gitlab:backup:restore BACKUP=xxxxxx
    gitlab-rake gitlab:backup:restore #backups目录只有一个备份时使用  
    
    ###########################################################
    ##汉化
    #下载对于版本的汉化包
    https://coding.net/u/larryli/p/gitlab/git/tree/v8.1.2.zh1/
    #停止服务
    gitlab-ctl stop
    cp -arp /opt/gitlab/embedded/service/gitlab-rails /opt/gitlab/embedded/service/gitlab-rails-bak/
    #下载汉化版替换
    cd /root/gitlab
    unzip *.zh1.zip
     cp -arp /root/gitlab/gitlab-v8.1.2.zh1/.  /opt/gitlab/embedded/service/gitlab-rails/
    gitlab-ctl reconfigure #重新加载配置启动GitLab
    
    ##GitLab修改root用户密码
    # root用户下执行
        gitlab-rails console production
        user = User.where(id: 1).first
        user.password=12345678
        user.password_confirmation=12345678
        user.save!
        quit
    ########完成
    
    ###########################################################
    #AD域配置文件,AD认证用户要对应其目录
    #也可以使用OpenLADP
    cp /etc/gitlab/gitlab.rb{,.bak}
    #cp /etc/gitlab/gitlab.rb.bak /etc/gitlab/gitlab.rb
    vim /etc/gitlab/gitlab.rb
    #gitlab
    external_url 'http://192.168.18.10'
    #  LDAP,AD
     gitlab_rails['ldap_enabled'] = true
     gitlab_rails['ldap_servers'] = YAML.load <<-EOS
       main: # 'main' is the GitLab 'provider ID' of this LDAP server
         label: 'xlh'
         host: '172.16.16.16' #AD的IP#
         port: 389
         uid: 'sAMAccountName'
         method: 'plain' # "tls" or "ssl" or "plain"
         bind_dn: 'CN=gitlab,OU=Dev,OU=users,DC=test,DC=dev'
         password: '12345678'
         active_directory: true
         allow_username_or_email_login: false
         block_auto_created_users: false
         allow_username_or_email_login: false
         block_auto_created_users: false
         base: 'OU=Dev,OU=users,DC=test,DC=dev'
         user_filter: ''
         group_base: ''
         admin_group: ''
         sync_ssh_keys: false
    EOS
    ###########
    gitlab-ctl reconfigure #重新载入配置
  • 相关阅读:
    ubuntu12.04 死机 卡屏 画面冻结解决方案
    Install Firefox 20 in Ubuntu 13.04, Ubuntu 12.10, Ubuntu 12.04, Linux Mint 14 and Linux Mint 13 by PPA
    ListView1.SelectedItems.Clear()
    android studio 下载地址
    jquery.slider.js jquery幻灯片测试
    jquery.hovermenu.js
    jquery.tab.js选项卡效果
    适配 placeholder,jquery版
    jquery.autoscroll.js jquery自动滚动效果
    将 Google Earth 地图集成到自己的窗体上的 简单控件
  • 原文地址:https://www.cnblogs.com/kcxg/p/10502563.html
Copyright © 2020-2023  润新知