zoukankan      html  css  js  c++  java
  • gitlab搭建与配置说明

     

    1. 概述

    Gitlab分为社区版和企业版,此次安装的是社区版(gitlab-ce)。

    2. 准备

    本次使用系统为Ubuntu16.04

    3. 安装

    添加GitLab仓库,并安装到服务器上(将gitlab安装源添加到apt中,然后通过apt-get安装)。

    一键安装命令:

    curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.deb.sh | sudo bashsudo apt-get install gitlab-ce

    本次下载的版本为gitlab 11,大概400MB.(gitlab-ce-11.1.8-ce.0.el7)

    Gitlab发邮件需要postfix,安装对应软件工具:

    sudo apt-get install postfix

    4. 常用命令

    首次安装成功需要执行sudo gitlab-ctl reconfigure进行启动。

    常用命令

    说明

    sudo gitlab-ctl reconfigure

    重新加载配置,每次修改/etc/gitlab/gitlab.rb文件之后执行

    sudo gitlab-ctl status

    查看 GitLab 状态

    sudo gitlab-ctl start

    启动 GitLab

    sudo gitlab-ctl stop

    停止 GitLab

    sudo gitlab-ctl restart

    重启 GitLab

    sudo gitlab-ctl tail

    查看所有日志

    sudo gitlab-ctl tail nginx/gitlab_acces.log

    查看 nginx 访问日志

    sudo gitlab-ctl tail postgresql

    查看 postgresql 日志

    5. 配置

    5.1. 修改默认端口

    5.1.1. 修改nginx端口

    默认为使用80端口。

    sudo vi /etc/gitlab/gitlab.rb

    nginx['listen_port'] = 8081
    sudo vi /var/opt/gitlab/nginx/conf/gitlab-http.conf
    server {
      listen *:8081;

    5.1.2. 修改unicorn端口

    该步骤可以不修改,默认为8080端口。

    sudo vi /etc/gitlab/gitlab.rb

    unicorn['port'] = 8083
    sudo vi /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
    listen "127.0.0.1:8083", :tcp_nopush => true

    5.1.3. 保存配置,重启。

    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    sudo gitlab-ctl status

    使用ip:8081访问即可

    5.2. 修改项目地址

    GitLab 项目创建后修改下载地址的ip和端口方法,修改下面文件即可:

    vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

    文件内容:

    ## GitLab settings

      gitlab:

        ## Web server settings (note: host is the FQDN, do not include http://)

        host: localhost         >> 这里改为主机的IP

        port: 80              >> 这里改为主机的端口

        https: false

        # Uncommment this line below if your ssh host is different from HTTP/HTTPS one

        # (you'd obviously need to replace ssh.host_example.com with your own host).

        # Otherwise, ssh host will be set to the `host:` value above

    重启GitLab即可。

    gitlab-ctl restart

    6. 访问

    打开浏览器,通过ip和端口即可访问gitlab,第一次登陆系统需要修改管理员密码。

  • 相关阅读:
    Service
    adb server is out of date
    Notification.Builder
    eclipse连接小米2调试程序的问题
    Date类
    this指向冒泡排序二分查找
    Dom事件键盘事件
    Dom事件键盘事件
    12.4Dom事件键盘事件
    事件对象
  • 原文地址:https://www.cnblogs.com/gongxr/p/9232588.html
Copyright © 2011-2022 走看看