zoukankan      html  css  js  c++  java
  • 07.Linux系统-GitLab版本控制服务安装部署

    官方文档:https://about.gitlab.com/install/#centos-7

    1.yum install -y curl policycoreutils-python openssh-server
    2.systemctl start sshd
    3.yum install postfix
    4.systemctl start postfix

    注:报错就改/etc/postfix/main.cf-->inet_interfaces = all

    5.curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | bash
    6.EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

    建议下载对应版本然后yum install -y xxxxx 在修改/etc/gitlab/gitlab.conf中的EXTERNAL_URL

    首先修改gitlab.rb文件再进行加载配置文件,不然会冲突

    gitlab命令:gitlab-ctl reconfigure 刷新加载配置文件

    gitlab-ctl stop/statr/status

    注: 首先呢 如果是个空机器什么都不用管 域名映射直接访问就行了

    如果本地有现有的Nginx,在启动gitlab就会出现两个Nginx冲突的问题,需要以下方法修改

    一般在迁移的时候会备份一下然后copy.tar文件gitlab备份
    修改配置文件/etc/gitlab/gitlab.rb
    gitlab_rails['manage_backup_path'] = true
    gitlab_rails['backup_path'] = "/data/gitlab/backups"  //gitlab备份目录
    gitlab_rails['backup_archive_permissions'] = 0644    //生成的备份文件权限
    gitlab_rails['backup_keep_time'] = 7776000         //备份保留天数为3个月(即90天,这里是7776000秒)

    gitlab备份恢复:

    gitlab-rake gitlab:backup:create
    gitlab-rake gitlab:backup:restore BACKUP=1510472027_2017_11_12_9.4.5-ee

    使用现有Nginx需要进行如下配置:

    gitlab.rb文件配置详情
    external_url 'http://git.LuckyHaTech.con'
    gitlab_workhorse['listen_addr'] = "xx.xxx.xx.xxx:9080"
    unicorn['port'] = 9080
    web_server['external_users'] = ['root']
    nginx['enable'] = false

    Nginx配置详情: 直接添加以下内容即可,此配置未加载日志,可自行配置;更改端口确保与gitlab.rb文件中的端口一致即可

    upstream gitlab {
    server unix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
    }

    server {
    listen 80;
    server_name git.LuckyHaTech.con;
    server_tokens off;
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    client_max_body_size 250m;

    location / {
    try_files $uri $uri/index.html $uri.html @gitlab;
    }
    location @gitlab {
    proxy_read_timeout 300; # Some requests take more than 30 seconds.
    proxy_connect_timeout 300; # Some requests take more than 30 seconds.
    proxy_redirect off;
    proxy_set_header X-Forwarded-Proto $scheme;
    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-Frame-Options SAMEORIGIN;
    proxy_pass http://localhost:9080;
    }
    location ~ ^/(assets)/ {
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    expires max;
    add_header Cache-Control public;
    }
    error_page 502 /502.html;
    }


    重载Nginx

    systemctl reload nginx.service

    重载gitlab

    gitlab-ctl reconfigure

    访问域名,完毕!

     

     

  • 相关阅读:
    PHP学习之路(六)
    PHP学习之路(五)
    PHP学习之路(四)
    PHP学习之路(三)
    PHP学习之路(二)
    PHP学习之路(一)
    webstrom运行出现404的解决办法
    适配移动端Swiper的3D旋转木马轮播~
    为什么觉得英文字体设计比中文字体设计来的好看?
    linux 部署系统通过SecureCRT启动tomcat 控制台中文乱码
  • 原文地址:https://www.cnblogs.com/LuckyHaTech/p/11988191.html
Copyright © 2011-2022 走看看