Fork me on GitHub

版权声明 本站原创文章 由 萌叔 发表
转载请注明 萌叔 | https://vearne.cc

安装gitlab社区版

参考资料:
非常重要 https://about.gitlab.com/downloads/#ubuntu1404
我是直接在ubuntu14.04上安装的
PS:官方文档是最有价值的,我来当下搬运工

1. 安装必要的包

sudo apt-get install curl openssh-server ca-certificates postfix

其中
postfix 是邮件发送程序
ca-certificates使用来对公钥进行验证的

2. 安装gitlab社区版

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

3. 安装启动gitlab

sudo gitlab-ctl reconfigure

4. 访问gitlab主页

这里写图片描述

经过观察我发现gitlab默认会在机器上安装

1)Ruby

2)Redis

安装路径
/var/opt/gitlab/redis
默认监听在unix域套接字上(还好没暴露在公网上)
/var/opt/gitlab/redis/redis.socket

3)PostgreSQL

4)Nginx

安装路径 /opt/gitlab/embedded/sbin/nginx
配置文件路径 /var/opt/gitlab/nginx/conf

nginx作为反向代理,后面挂有用unicorn启动的ruby进程,提供web服务
默认nginx需要占用80端口,所以这有可能会与你原先配置的web服务造成冲突

upstream gitlab-workhorse {
  server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}

server {
  listen *:8000;  # 默认为listen *:80
  server_name code.xxx.club; # ***必须修改*** 默认为主机名
}

这里必须修改server_name,代码库中的git project地址都依赖此值

注意 gitlab的web代码中有直接使用80端口的URL Redirect,所以必须允许gitlab使用80端口

可以用其它nginx做反向代理,来避免端口冲突

    upstream gitlab{
        server 127.0.0.1:8000;
    }

    server {
        listen       80;
        server_name  code.xxx.club;
        access_log  /var/log/nginx/code_access.log;
        error_log /var/log/nginx/code_error.log warn;
        index index.html index.htm;

        location / {
            proxy_pass   http://gitlab;
        }
    }

另外可以通过修改

vim /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure

来实现对gitlab运行参数的修改
其它资料:
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md


请我喝瓶饮料

微信支付码

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据