gitlab的部署

gitlab

1. gitlab简介

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

2. gitlab部署

//安装git以及依赖包
[root@master ~]# yum -y install epel-release git curl openssh-server openssh-clients postfix cronie perl

[root@master ~]# rpm -qa|grep policy
selinux-policy-3.14.3-80.el8.noarch
selinux-policy-targeted-3.14.3-80.el8.noarch
policycoreutils-2.9-16.el8.x86_64
[root@master ~]# rpm -e policycoreutils --nodeps
[root@master ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/policycoreutils-python-2.5-34.el7.x86_64.rpm
[root@master ~]# rpm -ivh --nodeps policycoreutils-python-2.5-34.el7.x86_64.rpm 

//启动postfix服务并设置开机自启
[root@master ~]# systemctl  restart postfix
[root@master ~]# systemctl  enable postfix

//下载gitlab的rpm包
[root@master ~]# cd /usr/src/
[root@master src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm
[root@master src]# ls
debug  gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm  kernels

//安装gitlab
[root@master src]# rpm -ivh gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm 
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@master ~]# vim /etc/gitlab/gitlab.rb 
......  //此处为省略内容
 //将此处设为gitlab的服务器ip地址亦或域名
external_url 'http://192.168.160.132'
......  //此处为省略内容

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

//查看当前的gitlab版本
[root@master ~]# head -1 /opt/gitlab/version-manifest.txt 
gitlab-ce 15.3.3

//破解管理员密码
[root@master ~]# 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 37.28s ]
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 = 'ye2237966451'
=> "ye2237966451"
irb(main):003:0> user.password_confirmation = 'ye2237966451'    //密码必须至少8个字符
=> "ye2237966451"
irb(main):004:0> user.save!
=> true
irb(main):005:0> exit

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

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当然,我可以为您提供GitLab部署的详细步骤。以下是一般情况下的步骤: 1. 准备服务器: - 获取一台新的服务器,可以是物理服务器或云服务器。 - 确保服务器满足GitLab的最低系统要求,如操作系统、存储和内存等。 2. 安装依赖项: - 更新服务器软件包并安装所需的依赖项,如curl、openssh-server、ca-certificates、postfix等。 3. 安装GitLab: - 使用官方提供的安装脚本进行安装。访问GitLab官方网站,找到适合您操作系统的安装文档,复制相应的安装脚本并在服务器上运行。 4. 配置GitLab: - 打开浏览器,访问您服务器的IP地址或域名,进入GitLab的Web界面。 - 首次访问会要求您设置管理员账户密码,设置完成后登录。 - 在Web界面中,您可以配置GitLab的各种设置,如网络、用户、权限、存储等。 5. 配置域名和SSL: - 如果您计划使用域名访问GitLab,并且希望使用HTTPS加密连接,请配置域名和SSL证书。 - 获取域名并将其解析到您服务器的IP地址。 - 配置Nginx或Apache等Web服务器,启用SSL并安装SSL证书。 6. 配置备份和恢复: - 配置GitLab的备份和恢复功能,以防止数据丢失。 - 定期执行备份,并将备份文件存储在安全的位置。 这些是一般的步骤,具体的部署过程可能会根据您的环境和需求有所不同。希望对您有所帮助!如有任何疑问,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值