不积跬步无以至千里

记录精彩的程序人生

  • 首页
  • Java
  • Golang
  • PHP
  • Python
  • Nodejs
  • Lua
  • Docker
  • DevOps
  • 文章归档
  • 默认分类
  • 关于
  • 标签

  • 搜索
PostgreSQL hbase 时间同步 nexus 开机启动 nexus, 开机启动 jenkins安装配置 gitlab安装配置 gitlab安装 文件系统 fastdfs gcc切换 gcc升级 mysql8 交换空间 虚拟内存 tcp thrift lua tag test VPN SoftEtherVPN homebrew asm spring tomcat maven jdk ios mac 图案字符 figlet mysql半同步复制 mysql主从同步 一主多从 一主一从 主从同步 反向代理 密码重置 test 虚拟机扩容 swap 虚拟空间 docker ldocker grpc-gateway protobuf 微服务 go grp GRPC 授权登录 OAuth2.0 SOA supervisord supervisor RPC CentOS rabbitmq 环境变量 php-fpm php.ini error php7 lnmp 编译安装 mysql nginx linux java php python redis 字符串操作 mysql5.7 Solo

Centos安装Gitlab、Jenkins、Nexus实现持续集成-gitlab安装、配置、错误锦集

发表于 2021-11-12 | 分类于 DevOps | 0 | 阅读次数 2615

安装Gitlab

准备工作:

  • 安装之前硬盘可用空间建议10G以上,否则可能碰到因空间不足导致安装、配置问题。
  • 关闭防火墙 systemctl stop firewalld.service
安装依赖
yum -y install  epel-release curl openssh-server openssh-clients postfix cronie policycoreutils-python
下载安装包(centos6.x=el6, centos7.x=el7, centos8.x=el8按需选择)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm --no-check-certificate
安装
rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

配置Gitlab

修改配置文件:vi /etc/gitlab/gitlab.rb
external_url 'http://192.168.200.100:8081'
重新加载配置文件
gitlab-ctl reconfigure

启动并检查运行状态

启动gitlab

gitlab-ctl start

正常运行后启动了很多进程和端口,其中8081是gitlab对外访问的端口

[root@localhost soft]# netstat -tpnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      1217/nginx: master  
tcp        0      0 127.0.0.1:9121          0.0.0.0:*               LISTEN      1231/redis_exporter 
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN      1235/prometheus     
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN      1239/postgres_expor 
tcp        0      0 127.0.0.1:9093          0.0.0.0:*               LISTEN      1224/alertmanager   
tcp        0      0 127.0.0.1:9100          0.0.0.0:*               LISTEN      1227/node_exporter  
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN      1216/gitlab-workhor 
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      1212/puma 4.3.3.git 
tcp        0      0 127.0.0.1:9168          0.0.0.0:*               LISTEN      1233/puma 4.3.3.git 
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      1217/nginx: master  
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      1331/sidekiq 5.2.7  
tcp        0      0 127.0.0.1:9236          0.0.0.0:*               LISTEN      1306/gitaly         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      950/sshd            
tcp        0      0 127.0.0.1:3000          0.0.0.0:*               LISTEN      1237/grafana-server 
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1173/master         
tcp6       0      0 :::9094                 :::*                    LISTEN      1224/alertmanager   
tcp6       0      0 ::1:9168                :::*                    LISTEN      1233/puma 4.3.3.git 
tcp6       0      0 :::22                   :::*                    LISTEN      950/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1173/master              

设置管理账号root的密码

  1. 进入gitlab命令行
[root@localhost soft]# sudo gitlab-rails console -e production
--------------------------------------------------------------------------------
 GitLab:       13.1.2 (2e7a6f64b07) FOSS
 GitLab Shell: 13.3.0
 PostgreSQL:   11.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.1)
irb(main):001:0> 
  1. 查询所有账号信息
irb(main):001:0> User.all
=> #<ActiveRecord::Relation [#<User id:1 @root>]>
  1. 查出id = 1的root账号
irb(main):002:0> user=User.where(id:1).first
=> #<User id:1 @root>
  1. 设置root密码为 111111
irb(main):003:0> user.password='111111'
=> "111111"
irb(main):004:0> user.password_confirmation='111111'
=> "111111"
  1. 保存密码
irb(main):005:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 2222b8da-6863-4909-8e35-c01ee88c9dd5) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f85c6d40ac8 @uri=#<URI::GID gid://gitlab/User/5>>]}
=> true

错误锦集

gitlab安装完后执行gitlab-ctl reconfigure时卡在

ruby_block[wait for redis service socket] action run

image.png
解决方法:

另起shell终端执行该命令,或先执行该命令再重新执行gitlab-ctl reconfigure
systemctl start gitlab-runsvdir

GitLab 报错 ConnectionBad: could not connect to server: No such...

解决方法:

1、按住CTRL+C强制结束
2、先停止 gitlab ,命令: sudo gitlab-ctl stop
3、执行命令: sudo chmod 755 /var/opt/gitlab/postgresql
4、执行命令:sudo systemctl restart gitlab-runsvdir
5、再次配置:sudo gitlab-ctl reconfigure
6、启动即可:sudo gitlab-ctl restart

502, whoops, gitlab is taking too much time to respond

原因:8080端口被占用,修改端口号并重启

随便修改成一个不会被占用的端口
unicorn['port'] = 8088
打开注释
postgresql['shared_buffers'] = "256MB"
打开注释
postgresql['max_connections'] = 200

gitlab常用命令

gitlab-ctl start       # 启动所有 gitlab 组件;
gitlab-ctl stop        # 停止所有 gitlab 组件;
gitlab-ctl restart     # 重启所有 gitlab 组件;
gitlab-ctl status      # 查看服务状态;
gitlab-ctl reconfigure # 重新加载配置并启动服务;
gitlab-ctl tail        # 查看日志;
systemctl enable gitlab-runsvdir.service #开机启动
systemctl disable gitlab-runsvdir.service #禁开机启动

参考

https://www.yisu.com/zixun/672.html
https://blog.csdn.net/OldDirverHelpMe/article/details/106536972
https://www.cnblogs.com/easonscx/p/12608480.html
https://blog.csdn.net/huhuhuemail/article/details/80519433
https://blog.csdn.net/qq_36793589/article/details/111573754
https://cloud.tencent.com/developer/article/1511600

# gitlab安装配置
Centos安装、配置、分布式部署文件系统FastDfs
Vmware、Parallels Desktop虚拟机Centos磁盘扩容
  • 文章目录
  • 站点概览
ken

ken

记录精彩的程序人生

498 日志
9 分类
77 标签
RSS
Creative Commons
Links
  • 酷壳
0%
© 2010 — 2025 ken
由 Halo 强力驱动
鄂ICP备18013899号-1