gitlab

GitLab是一个开源的代码管理系统,基于Ruby on Rails构建,提供仓库管理、wiki和issue跟踪等功能。广泛应用于IBM、NASA等组织。本文将介绍GitLab的含义、特点,并指导如何进行GitLab的部署。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gitlab

介绍:

GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的Web服务。安装方法是参考GitLab在GitHub上的Wiki页面。Gitlab是目前被广泛使用的基于git的开源代码管理平台, 基于Ruby on Rails构建, 主要针对软件开发过程中产生的代码和文档进行管理, Gitlab主要针对group和project两个维度进行代码和文档管理, 其中group是群组, project是工程项目, 一个group可以管理多个project, 可以理解为一个群组中有多项软件开发任务, 而一个project中可能包含多个branch, 意为每个项目中有多个分支, 分支间相互独立, 不同分支可以进行归并

含义:

GitLab是由GitLabInc.开发,使用MIT许可证的基于网络的Git仓库管理工具,且具有wiki和issue跟踪功能。使用Git作为代码管理工具,并在此基础上搭建起来的web服务。
GitLab由乌克兰程序员DmitriyZaporozhets和ValerySizov开发,它使用Ruby语言写成。后来,一些部分用Go语言重写。截止2018年5月,该公司约有290名团队成员,以及2000多名开源贡献者。GitLab被IBM,Sony,JülichResearchCenter,NASA,Alibaba,Invincea,O’ReillyMedia,Leibniz-Rechenzentrum(LRZ),CERN,SpaceX等组织使用。

特点:

1.Web框架使用RubyonRails。
2.基于MIT代码发布协议。
3.需要gitolite协同工作。

gitlab部署

gitlab下载链接

//关闭防火墙和selinux
[root@Sia ~]# systemctl disable --now firewalld.service 
[root@Sia ~]# setenforce 0
[root@Sia ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config 
 
//安装epel
[root@Sia ~]# dnf -y install epel-release
 
//安装依赖包
 dnf -y install git wget curl openssh-server openssh-clients postfix cronie
 
 //下载或上传policycoreutils-python和gitlab包
[root@Sia ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/policycoreutils-python-2.5-34.el7.x86_64.rpm
 
[root@Sia ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm
 
[root@Sia ~]# ls
anaconda-ks.cfg gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm policycoreutils-python-2.5-34.el7.x86_64.rpm
[root@Sia ~]# 
 
//rpm安装
//首先查看,发现有一个policycoreutils-2.9-18.el8.x86_64,版本过低,先卸载
[root@Sia ~]# rpm -qa|grep policy
policycoreutils-2.9-18.el8.x86_64
selinux-policy-3.14.3-91.el8.noarch
selinux-policy-targeted-3.14.3-91.el8.noarch
[root@Sia ~]# rpm -e policycoreutils-2.9-18.el8.x86_64
[root@Sia ~]# 
//再进行安装
[root@Sia ~]# rpm -ivh policycoreutils-python-2.5-34.el7.x86_64.rpm --nodeps
warning: policycoreutils-python-2.5-34.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:policycoreutils-python-2.5-34.el7################################# [100%]
//最后安装gitlab包 
[root@Sia ~]# rpm -ivh policycoreutils-python-2.5-34.el7.x86_64.rpm 
warning: policycoreutils-python-2.5-34.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
[root@Sia ~]# rpm -ivh gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm --nodeps
warning: gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:gitlab-ce-15.3.3-ce.0.el7        ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.
 
       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  
 
 
     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  
 
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure
 
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
 
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=15-3
 
//修改配置文件
[root@Sia ~]# vim /etc/gitlab/gitlab.rb 
 
external_url 'http://192.168.48.151'   //修改此处为本机ip或域名
 
//重载配置文件并重启gitlab
[root@Sia ~]# gitlab-ctl reconfigure
…………
[root@Sia recipes]# gitlab-start
-bash: gitlab-start: command not found
[root@Sia recipes]# gitlab-ctl start
ok: run: alertmanager: (pid 250988) 1s
ok: run: gitaly: (pid 250998) 0s
ok: run: gitlab-exporter: (pid 251018) 1s
ok: run: gitlab-kas: (pid 251043) 0s
ok: run: gitlab-workhorse: (pid 251053) 0s
ok: run: logrotate: (pid 251088) 1s
ok: run: nginx: (pid 251126) 0s
ok: run: node-exporter: (pid 251160) 1s
ok: run: postgres-exporter: (pid 251168) 0s
ok: run: postgresql: (pid 251175) 1s
ok: run: prometheus: (pid 251208) 0s
ok: run: puma: (pid 251294) 0s
ok: run: redis: (pid 251323) 1s
ok: run: redis-exporter: (pid 251361) 0s
ok: run: sidekiq: (pid 251368) 1s
 
 
//查看当前的gitlab版本
[root@Sia ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 15.3.3
 
//破解管理员密码
[root@Sia recipes]# gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
 GitLab:       15.3.3 (c629a47f87f) FOSS
 GitLab Shell: 14.10.0
 PostgreSQL:   13.6
------------------------------------------------------------[ booted in 17.09s ]
Loading production environment (Rails 6.1.6.1)
irb(main):001:0> user = User.where(id: 1).first		//id为1的是超级管理员
=> #<User id:1 @root>
irb(main):002:0> user.password = 'Sia666666'		//密码必须至少8个字符
=> "Sia666666"
irb(main):003:0> user.password_confirmation = 'Sia666666'
=> "Sia666666"
irb(main):004:0> user.save! 				//保存修改,若无问题将返回true
=> true
 
//设置服务开机自启
[root@Sia ~]# which gitlab-ctl 
/usr/bin/gitlab-ctl
[root@Sia ~]# chmod +x /etc/rc.d/rc.local 
[root@Sia ~]# echo "/usr/bin/gitlab-ctl start " >> /etc/rc.d/rc.local 
[root@Sia ~]# cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
 
touch /var/lock/subsys/local
 
/usr/bin/gitlab-ctl start
# 1、下载rpm源文件 * rpm下载不了的文件可以到[rpm官方](http://rpm.pbone.net/)进行下载 # 2、执行rpm文件 * 1、以下的rpm文件是有依赖,需要安装顺序进行执行. * 2、执行policycoreutils-python-2.5-29.el7.x86_64.rpm发现报 错误:依赖检测失败: policycoreutils = 2.5-22.el7 被 policycoreutils-python-2.5-22.el7.x86_64 需要 去rpm官方网找了一个`policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm`最新的安装包执行安装 * 3、python-kitchen-1.1.1-5.el7.noarch.rpm可以不需要安装 ``` rpm -ivh libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm rpm -ivh audit-libs-python-2.8.4-4.el7.x86_64.rpm rpm -ivh libcgroup-0.41-20.el7.x86_64.rpm rpm -ivh libsemanage-python-2.5-14.el7.x86_64.rpm rpm -ivh checkpolicy-2.5-8.el7.x86_64.rpm rpm -ivh python-IPy-0.75-6.el7.noarch.rpm rpm -ivh setools-libs-3.3.8-4.el7.x86_64.rpm rpm -ivh policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm rpm -ivh container-selinux-2.74-1.el7.noarch.rpm rpm -ivh libseccomp-2.3.1-3.el7.x86_64.rpm rpm -ivh containerd.io-1.2.0-3.el7.x86_64.rpm rpm -ivh docker-ce-cli-18.09.0-3.el7.x86_64.rpm rpm -ivh docker-ce-18.09.0-3.el7.x86_64.rpm ``` # 3、启动docker ``` systemctl daemon-reload && systemctl restart docker ``` # 4、设置开机启动 * Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. ``` systemctl enable docker.service ``` # 5、验证docker ``` docker version ``` # 参考文章 * [CentOS 7.5离线安装Docker 18.09.3软件](https://jingyan.baidu.com/article/fb48e8becf31a16e632e145f.html)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值