gitlab搭建安装及使用中遇到的问题。

cherry-linux cherry-linux     2022-10-09     327

关键词:

一、CentOS7安装gitlab-ce

1.下载及安装rpm软件包。

下载RPM包

curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.9.8-ce.0.el7.x86_64.rpm

安装RPM包

rpm -i gitlab-ce-8.9.8-ce.0.el7.x86_64.rpm

2.修改Gitlab配置文件。

vim /etc/gitlab/gitlab.rb

external_url 'http://gitlab.federico.xin:7389'

? 以上的配置文件是确定gitlab监听的域名以及ip地址,当我们设置完成后执行以下命令将配置写入所有配置文件当中。

重新加载配置文件

gitlab-ctl reconfigure

3.启动Gitlab服务并检查服务是否正常启动。

启动Gitlab

gitlab-ctl start

ok: run: gitlab-workhorse: (pid 5294) 0s
ok: run: logrotate: (pid 5296) 0s
ok: run: nginx: (pid 5300) 0s
ok: run: postgresql: (pid 5302) 0s
ok: run: redis: (pid 5306) 0s
ok: run: sidekiq: (pid 5309) 0s
ok: run: unicorn: (pid 5312) 0s

检查Gitlab进程是否成功启动

ps aux|grep git

git       5271 57.6 11.2 399596 212268 ?       Rl   10:29   0:07 ruby /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git       5294  0.0  0.2  37768  4036 ?        Ssl  10:29   0:00 /opt/gitlab/embedded/bin/gitlab-workhorse -listenNetwork unix -listenUmask 0 -listenAddr /var/opt/gitlab/gitlab-workhorse/socket -authBackend http://localhost:8080 -authSocket /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket -documentRoot /opt/gitlab/embedded/service/gitlab-rails/public -pprofListenAddr
root      5296  0.0  0.0  11628  1408 ?        Ss   10:29   0:00 /bin/sh /opt/gitlab/embedded/bin/gitlab-logrotate-wrapper
root      5300  0.0  0.1  37608  2920 ?        Ss   10:29   0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+  5302  0.2  1.8 532352 34240 ?        Ss   10:29   0:00 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
gitlab-+  5306  0.0  0.4  37400  7864 ?        Ssl  10:29   0:00 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
git       5309 43.8  3.0 159376 58368 ?        Rsl  10:29   0:02 ruby /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/sidekiq -q post_receive -q mailers -q archive_repo -q system_hook -q project_web_hook -q gitlab_shell -q incoming_email -q common -q pages -q elasticsearch -q default -e production -r /opt/gitlab/embedded/service/gitlab-rails -t 4 -c 25
git       5312  0.0  0.0  11632  1516 ?        Ss   10:29   0:00 /bin/bash /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper
gitlab-+  5313  0.0  0.2  41700  5172 ?        S    10:29   0:00 nginx: worker process
gitlab-+  5314  0.0  0.0  37760  1492 ?        S    10:29   0:00 nginx: cache manager process
gitlab-+  5315  0.0  0.0  37760  1492 ?        S    10:29   0:00 nginx: cache loader process
gitlab-+  5330  0.0  0.0 532584  1184 ?        Ss   10:29   0:00 postgres: checkpointer process
gitlab-+  5331  0.0  0.0 532584  1192 ?        Ss   10:29   0:00 postgres: writer process
gitlab-+  5332  0.0  0.0 532584   944 ?        Ss   10:29   0:00 postgres: wal writer process
gitlab-+  5333  0.0  0.1 533572  2384 ?        Ss   10:29   0:00 postgres: autovacuum launcher process
gitlab-+  5334  0.0  0.0  26556  1264 ?        Ss   10:29   0:00 postgres: stats collector process
git       5339  0.0  0.0   4308   344 ?        S    10:29   0:00 sleep 1
gitlab-+  5340  0.0  0.4 638200  7964 ?        Ss   10:29   0:00 postgres: gitlab gitlabhq_production [local] idle
root      5342  0.0  0.0 112656   960 pts/0    S+   10:29   0:00 grep --color=auto git
root     32239  0.0  0.0   4328   488 ?        Ss   09:41   0:00 runsvdir -P /opt/gitlab/service log: ...........................................................................................................................................................................................................................................................................................................................................................................................................
root     32260  0.0  0.0   4320   540 ?        S    09:41   0:00 svlogd -tt /var/log/gitlab/redis
root     32343  0.0  0.0   4320   536 ?        S    09:41   0:00 svlogd -tt /var/log/gitlab/postgresql
root     32426  0.0  0.0   4320   540 ?        S    09:42   0:00 svlogd -tt /var/log/gitlab/unicorn
root     32458  0.0  0.0   4320   544 ?        S    09:42   0:00 svlogd -tt /var/log/gitlab/sidekiq
root     32468  0.0  0.0   4176   344 ?        Ss   09:42   0:00 runsv gitlab-workhorse
root     32469  0.0  0.0   4320   540 ?        S    09:42   0:00 svlogd -tt /var/log/gitlab/gitlab-workhorse
root     32475  0.0  0.0   4320   340 ?        S    09:42   0:00 svlogd -tt /var/log/gitlab/nginx
root     32487  0.0  0.0   4320   540 ?        S    09:42   0:00 svlogd -tt /var/log/gitlab/logrotate

? 以上,我们已经将Gitlab服务启动完成,并监听在7389端口,下面我们开始配置前端nginx反向代理Gitlab。

二、配置Nginx反向搭理Gitlab

1.修改Nginx配置文件

vim /etc/nginx/conf.d/gitlab.conf

upstream  git{
    server  ip:port;
}


server{
    listen 80;
    server_name gitlab.federico.xin;

    location / {
        client_max_body_size 500m;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://git;
        index index.html index.htm;
    }
}

2.检查并重启Nginx

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

nginx -s reload

三、使用Gitlab过程中遇到的各种问题以及解决措施

1.fatal: The remote end hung up unexpectedly

? 在push代码到库时,出现上述报错,原因是因为上传的git包过大,可以通过以下设置解决此问题。
git config http.postBuffer 524288000

2.error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

? 出现以上问题同样是因为上传软件包过大,需要我们在nginx参数中进行调整设置文件传输大小的限制。需要注意的是,如果是反向代理的Gitlab需要我们将两台服务器的nginx都进行设置。
grep -r "client_max_body_size" /var/opt/gitlab/

/var/opt/gitlab/nginx/conf/gitlab-http.conf:  client_max_body_size 500M;
/var/opt/gitlab/nginx/conf/nginx.conf:  client_max_body_size 50m;

vim /var/opt/gitlab/nginx/conf/nginx.conf

client_max_body_size 500m;

nginx -t
nginx -s reload

gitlab服务部署及使用

一、什么是gitlib  Gitlab是一个基于Git实现的在线代码仓库托管软件,你可以用Gitlab自己搭建一个类似于Github一样的系统平台,一般搭建gitlab私服就是用在公司的内部  Gitlab功能就是能够对代码的提交审核和问题跟踪,这个对... 查看详情

gitlab升级gitlabomnibusce安装遇到的一些问题

 最近公司打算将内部使用的gitab7.14.3升级到最新的gitlab的OmnibusCE版本。但是由于内部使用的gitlab是源码安装的,使用的是外部数据库mysql5.6。 所以升级的方案是: 1.将源码安装的gitlab的数据迁移到OmnibusCEgitlab7.14.3的版... 查看详情

搭建gitlab私服详细步骤(代码片段)

从零开始搭建GitLab私服关于阿里云的选购搭建步骤相关环境以及依赖安装关闭防火墙或者防火墙增加白名单下载软件安装修改端口重启GitLab服务器在浏览器输入GItLab配置地址访问GitLab关于阿里云的选购 购买云服务器的话买个2... 查看详情

gitlab搭建(代码片段)

手把手教你GitLab的安装及使用 前言新入职公司,发现公司还在使用落后生产工具svn,由于重度使用过svn和git,知道这两个工具之间的差异,已经在使用git的路上越走越远。于是,跟上级强烈建议让我在公司推行git和他的私有... 查看详情

docker决战到底自己动手搭建gitlab服务

...个公司内部使用的Git服务器,而比较常见的就是搭建一个GitLab服务器。目前我所在的公司里面也是采用的自建GitLab,只是使用的是传统的软件源安装方式而不是基于容器化。所以,本篇实践记录就是自己动手来搭建一个基于Docker... 查看详情

gitlab的安装和使用

gitlab的安装和使用(二)使用过程中遇到的问题:数据盘不够用了解决办法:gitlab数据本地目录迁移gitlab代码数据默认目录:/var/opt/gitlab/git-data/repositories在新数据盘data目录下新建gitlab-data目录,把旧数据拷贝过去再重新启动gitlab,操作... 查看详情

caffecpuubuntu20.04安装环境搭建详细每一步遇到的所有问题及解决(代码片段)

x86平台LinuxUbuntu20.04系统环境下配置caffe本次项目需要使用到caffe的框架,开发人脸识别的功能,最终要集成到arm平台的linux系统。我先拿x86平台的主机试试水,对caffe和linux一窍不通的我来说,属实遇到了不少大大... 查看详情

使用docker部署gitlab

...由于用户和权限管理太麻烦。如今想在原有server上再搭建Gitlab,使用Gitlab官方方法直接安装。会导致与Gitosis冲突,使得Gitosis不可用,由于要保持两个服务同一时候存在。所以就想到利用Docker来搭建Gitlab。下面以Ubuntu14.04为例安... 查看详情

centos安装gitlab服务及创建git仓库实践笔记(代码片段)

GitLab是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的Web服务。安装方法是参考GitLab在GitHub上的Wiki页面。Gitlab是被广泛使用的基于git的开源代码管理平台,基于RubyonRails构建&#x... 查看详情

centos安装gitlab服务及创建git仓库实践笔记(代码片段)

GitLab是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的Web服务。安装方法是参考GitLab在GitHub上的Wiki页面。Gitlab是被广泛使用的基于git的开源代码管理平台,基于RubyonRails构建&#x... 查看详情

gitlab的安装及使用教程

一使用yum安装1、配置yum源vim/etc/yum.repos.d/gitlab-ce.repo复制以下内容: [gitlab-ce]name=GitlabCERepositorybaseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/gpgcheck=0enabled=1 2、更新本 查看详情

gitlab的安装及使用(代码片段)

GitLab的安装及使用前言GitLab安装GitLab使用SourceTree管理客户端软件前言Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。Git是一个开源的分布式版本控制系统,可以有效、高速的处理... 查看详情

gitlab的安装及使用(代码片段)

GitLab的安装及使用前言GitLab安装GitLab使用SourceTree管理客户端软件前言Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。Git是一个开源的分布式版本控制系统,可以有效、高速的处理... 查看详情

gitlab详细安装

...目的托管平台。GitHub可以托管各种Git库,并提供web界面。GitLabGitLab是一个用于仓库管理系统的开源项目,使用git进行代码管理工具,可以自己搭建GitLab仓库服务器。GitLab:是一个基于Git实现的在线代码仓库托管软件,你可以用git... 查看详情

gitlab和jenkins的安装及使用

...                         gitlab准备:最少4G内存先安装docker软件包然后使用dockersearchgitlab查找镜像然后使用dockerpull镜像名:标签名下载镜像启动容器:dockerrun-d-hgitlab--namegitlab-p443:443-p80:80-p22:22- 查看详情

使用docker搭建gitlab版本控制系统

1.GitLab简介GitLab是一款基于git的开源代码仓库系统  GitLab与著名的GitHub最大的区别就是: 允许我们搭建自己的git代码私有仓库,非常方便 2、安装Gitlab 安装Gitlab特别的复杂,因此这里我们使用docker搭建一款Gitlab... 查看详情

搭建jenkins服务中遇到的问题及解决办法

1执行java-jarjenkins.war时报错java.net.UnknownHostException:XXXXNameorservicenotknown 解决办法:修改/etc/hosts文件 127.0.0.1主机名localhost.localdomainlocalhost 或是再添加一条 127.0.0.1主机名2打开localhsot:8080时,报错unabletoconnect 原因是... 查看详情

java环境搭建及eclipse的安装与使用

JAVA实验环境的搭建1.下载安装JDK,若想要调用速度快点,可以安装到C盘,安装文件夹要用英文命名。2.搭建JAVA_HOME,,环境变量地址写为本地文件夹(既安装JDK时候的文件夹)。3.搭建ClassPath,,环境变量地址是本地JDK文件夹中lib文件... 查看详情