gitlab

简介
GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。GitLab由乌克兰程序员DmitriyZaporozhets和ValerySizov开发,它由Ruby写成。后来,一些部分用Go语言重写,现今并在国内外大中型互联网公司广泛使用。

git、gitlab、GitHub的简单区别
git 是一种基于命令的版本控制系统,全命令操作,没有可视化界面

gitlab 是一个基于git实现的在线代码仓库软件,提供web可视化管理界面,通常用于企业团队内部协作开发

github 是一个基于git实现的在线代码托管仓库,亦提供可视化管理界面,同时免费账户和提供付费账户,提供开放和私有的仓库,大部分的开源项目都选择github作为代码托管仓库

gitlab相关命令

gitlab-ctl start#启动全部服务
gitlab-ctl restart#重启全部服务
gitlab-ctl stop#停止全部服务
gitlab-ctl restart nginx#重启单个服务,如重启nginx
gitlab-ctl status#查看服务状态
gitlab-ctl reconfigure#使配置文件生效
gitlab-ctl show-config#验证配置文件
gitlab-ctl uninstall#删除gitlab(保留数据)
gitlab-ctl cleanse#删除所有数据,从新开始
gitlab-ctl tail 查看服务的日志
gitlab-ctl tail nginx#如查看gitlab下nginx日志
gitlab-rails console#进入控制台

gitlab部署

// 关闭防火墙和selinux
[root@localhost ~]# systemctl disable --now firewalld.service 

[root@localhost ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

// 安装epel-reseale源
[root@localhost ~]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
--2021-10-11 20:31:45--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
正在解析主机 dl.fedoraproject.org (dl.fedoraproject.org)... 38.145.60.23, 38.145.60.22, 38.145.60.24
正在连接 dl.fedoraproject.org (dl.fedoraproject.org)|38.145.60.23|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:23644 (23K) [application/x-rpm]
正在保存至: “epel-release-latest-8.noarch.rpm”

epel-release-latest-8.noarch.rp 100%[=======================================================>]  23.09K  42.9KB/s  用时 0.5s    

2021-10-11 20:31:47 (42.9 KB/s) - 已保存 “epel-release-latest-8.noarch.rpm” [23644/23644])

[root@localhost ~]# rpm -vih epel-release-latest-8.noarch.rpm
警告:epel-release-latest-8.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 2f86d6a1: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:epel-release-8-13.el8            ################################# [100%]


//安装git
[root@localhost ~]# yum -y install epel-release git

//安装依赖包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python-utils


//下载gitlab的rpm包
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm
--2021-10-11 20:46:49--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:961561901 (917M) [application/x-redhat-package-manager]
正在保存至: “gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm”

gitlab-ce-14.3.2-ce.0.el8.x86_6 100%[=======================================================>] 917.02M  9.67MB/s  用时 99s     

2021-10-11 20:48:28 (9.29 MB/s) - 已保存 “gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm” [961561901/961561901])

[root@localhost src]# rpm -ivh gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm 
警告:gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ce-14.3.2-ce.0.el8        ################################# [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=14-3

//修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb 
  32 external_url 'http://192.168.71.135'   // 把域名改成当前主机的IP

//启动postfix服务并设置开机自启
[root@localhost ~]# systemctl enable --now postfix.service 

//重载配置文件并重启gitlab
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值