gitlab部署文档

gitlab部署文档

环境说明:

ip : 192.168.31.11
系统: CentOS Linux release 7.9.2009 (Core)

gitlab-ce: 16.11.2(2024-05-08更新)

清华镜像站: Index of /gitlab-ce/yum/el7/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirroricon-default.png?t=N7T8https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/?C=M&O=D

1、下载rpm包

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-16.11.2-ce.0.el7.x86_64.rpm

2、安装依赖

yum install -y curl policycoreutils openssh-server openssh-clients

3、启动ssh服务&设置为开机启动

systemctl enable sshd systemctl start sshd

4、安装Postfix: Postfix是一个邮件服务器,GitLab发送邮件需要用到

yum install -y postfix

systemctl enable postfix #启动postfix并设置为开机启动 systemctl start postfix

5、开放ssh以及http服务(80端口)

firewall-cmd --add-service=ssh --permanent firewall-cmd --add-service=http --permanent

或者: systemctl stop firewalld     #直接关闭防火墙
      systemctl disable firewalld
      setenforce 0
6、安装gitlab依赖

yum install policycoreutils-python

7、安装gitlab

rpm -ivh gitlab-ce-16.11.2-ce.0.el7.x86_64.rpm

# 以下为效果展示

warning: gitlab-ce-16.11.2-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY Preparing...                         ################################# [100%] Updating / installing...   1:gitlab-ce-16.11.2-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=16-11

netstat -ntlp                #查看端口

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name     tcp       0     0 127.0.0.1:9100         0.0.0.0:*               LISTEN     1470/node_exporter   tcp       0     0 127.0.0.1:9229         0.0.0.0:*               LISTEN     1473/gitlab-workhor tcp       0     0 127.0.0.1:8080         0.0.0.0:*               LISTEN     1477/puma 6.4.0 (un tcp       0     0 127.0.0.1:9168         0.0.0.0:*               LISTEN     1466/ruby           tcp       0     0 127.0.0.1:8082         0.0.0.0:*               LISTEN     1658/sidekiq_export tcp       0     0 127.0.0.1:9236         0.0.0.0:*               LISTEN     1549/gitaly         tcp       0     0 127.0.0.1:8150         0.0.0.0:*               LISTEN     1467/gitlab-kas     tcp       0     0 0.0.0.0:22             0.0.0.0:*               LISTEN     1017/sshd           tcp       0     0 127.0.0.1:8151         0.0.0.0:*               LISTEN     1467/gitlab-kas     tcp       0     0 0.0.0.0:8888           0.0.0.0:*               LISTEN     1454/nginx: master   tcp       0     0 127.0.0.1:8153         0.0.0.0:*               LISTEN     1467/gitlab-kas     tcp       0     0 127.0.0.1:25           0.0.0.0:*               LISTEN     1204/master         tcp       0     0 127.0.0.1:8154         0.0.0.0:*               LISTEN     1467/gitlab-kas     tcp       0     0 127.0.0.1:8155         0.0.0.0:*               LISTEN     1467/gitlab-kas     tcp       0     0 127.0.0.1:8092         0.0.0.0:*               LISTEN     1656/sidekiq 7.1.6   tcp       0     0 0.0.0.0:8060           0.0.0.0:*               LISTEN     1454/nginx: master   tcp       0     0 127.0.0.1:9121         0.0.0.0:*               LISTEN     1456/redis_exporter tcp       0     0 127.0.0.1:9090         0.0.0.0:*               LISTEN     1463/prometheus     tcp       0     0 127.0.0.1:9187         0.0.0.0:*               LISTEN     1475/postgres_expor tcp       0     0 127.0.0.1:9093         0.0.0.0:*               LISTEN     1472/alertmanager   tcp6       0     0 ::1:9168               :::*                   LISTEN     1466/ruby           tcp6       0     0 :::22                   :::*                   LISTEN     1017/sshd           tcp6       0     0 ::1:25                 :::*                   LISTEN     1204/master         tcp6       0     0 :::9094                 :::*                   LISTEN     1472/alertmanager  

8、修改gilab配置

vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.31.11:8888'     #32行修改 ip:端口

9、启动

gitlab-ctl reconfigure   #重载

gitlab-ctl status   

gitlab-ctl status                                        
run: alertmanager: (pid 2339) 1864s; run: log: (pid 1461) 3144s                
run: gitaly: (pid 2349) 1863s; run: log: (pid 1435) 3144s                      
run: gitlab-exporter: (pid 2370) 1862s; run: log: (pid 1457) 3144s             
run: gitlab-kas: (pid 2381) 1851s; run: log: (pid 1458) 3144s                  
run: gitlab-workhorse: (pid 2391) 1851s; run: log: (pid 1471) 3144s            
run: logrotate: (pid 2404) 1851s; run: log: (pid 1439) 3144s                   
run: nginx: (pid 2412) 1850s; run: log: (pid 1451) 3144s                       
run: node-exporter: (pid 2420) 1850s; run: log: (pid 1468) 3144s               
run: postgres-exporter: (pid 2427) 1849s; run: log: (pid 1465) 3144s
run: postgresql: (pid 2437) 1849s; run: log: (pid 1464) 3144s
run: prometheus: (pid 2446) 1849s; run: log: (pid 1462) 3144s
run: puma: (pid 2458) 1848s; run: log: (pid 1476) 3144s
run: redis: (pid 2463) 1848s; run: log: (pid 1443) 3144s
run: redis-exporter: (pid 2470) 1847s; run: log: (pid 1455) 3144s
run: sidekiq: (pid 2480) 1845s; run: log: (pid 1459) 3144s

10、配置默认访问密码

注册用户的密码为abc12345

切换到命令运行的目录 cd /opt/gitlab/bin/ 执行如下命令:gitlab-rails console -e production 进行初始化密码

在irb(main):001:0> 后面通过 u=User.where(id:1).first 来查找与切换账号(User.all 可以查看所有用户)
gitlab-rails console -e production
u=User.where(id:1).first
u.password='abc12345'
u.password_confirmation='abc12345'
u.save!
exit
 
出现true说明设置成功!
此时就可以用root/abc12345来登录页面

报错记录:
irb(main):007:0> u.save!
/opt/gitlab/embedded/lib/ruby/gems/3.1.0/gems/activerecord-7.0.8.1/lib/active_record/validations.rb:80:in `raise_validation_error': Validation failed: Password must not contain commonly used combinations of words and letters (ActiveRecord::RecordInvalid)  

这个错误是由于密码不符合GitLab的密码策略而导致的验证失败。根据错误消息,密码必须符合以下要求:
密码确认与密码不匹配
密码不能包含常用的单词和字母组合
密码长度太短(最少为8个字符)

原文: Gitlab 仓库搭建(详细版)_gitlab搭建-CSDN博客

centos7 安装gitlab_错误:依赖检测失败: libcrypt.so.1()(64bit) 被 phddns-5.3.0-1-CSDN博客

CI/CD笔记.Gitlab系列:控制台强制修改root用户密码-云社区-华为云

  • 24
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 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
发出的红包

打赏作者

SilentCodeY

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值