すのはら荘春原庄的雪

Gitlab安装配置

Toretto·2024-09-15 22:32·4 次阅读

Gitlab安装配置

配置yum源#

[root@gitlab ~]# vim /etc/yum.repos.d/gitlab-ce.repo
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever
gpgcheck=0
enabled=1
# 安装Gitlab
[root@gitlab ~]# yum -y install gitlab-ce

修改gitlab配置文件#

[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
# 修改为我们本机的服务器IP
external_url 'http://192.168.13.121' 
# 设置时区为Asia/Shanghai
gitlab_rails['time_zone'] = 'Asia/Shanghai' 
# 设置数据存放目录
git_data_dirs({
  "default" => {
    "path" => "/mnt/nfs-01/git-data"
   }
})
# 开放ssh端口
gitlab_rails['gitlab_shell_ssh_port'] = 22

##关闭不需要的组件,以下根据情况进行
node_exporter['enable'] = false
redis_exporter['enable'] = false
alertmanager['enable'] = false
prometheus['enable'] = false
prometheus['monitor_kubernetes'] = false
postgres_exporter['enable'] = false
pgbouncer_exporter['enable'] = false
gitlab_exporter['enable'] = false
prometheus_monitoring['enable'] = false
grafana['enable'] = false

初始化gitlab#

[root@gitlab ~]# gitlab-ctl reconfigure #重新加载,大概需要10分钟左右
image-20240915220249883

启动gitlab#

[root@gitlab ~]# netstat -tnlp
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:8153          0.0.0.0:*               LISTEN      17504/gitlab-kas    
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1191/master         
tcp        0      0 127.0.0.1:8154          0.0.0.0:*               LISTEN      17504/gitlab-kas    
tcp        0      0 127.0.0.1:8155          0.0.0.0:*               LISTEN      17504/gitlab-kas    
tcp        0      0 127.0.0.1:8092          0.0.0.0:*               LISTEN      17742/sidekiq 7.1.6 
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      18149/nginx: master 
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN      18146/gitlab-workho 
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      17665/puma 6.4.0 (u 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      18149/nginx: master 
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      17744/sidekiq_expor 
tcp        0      0 127.0.0.1:9236          0.0.0.0:*               LISTEN      18141/gitaly        
tcp        0      0 127.0.0.1:8150          0.0.0.0:*               LISTEN      17504/gitlab-kas    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1027/sshd           
tcp        0      0 127.0.0.1:8151          0.0.0.0:*               LISTEN      17504/gitlab-kas    
tcp6       0      0 ::1:25                  :::*                    LISTEN      1191/master         
tcp6       0      0 :::22                   :::*                    LISTEN      1027/sshd

[root@gitlab ~]# gitlab-ctl status
run: gitaly: (pid 18188) 417s; run: log: (pid 17231) 887s
run: gitlab-kas: (pid 17504) 861s; run: log: (pid 17521) 858s
run: gitlab-workhorse: (pid 18146) 451s; run: log: (pid 17751) 741s
run: logrotate: (pid 17122) 900s; run: log: (pid 17131) 899s
run: nginx: (pid 18149) 450s; run: log: (pid 17808) 733s
run: postgresql: (pid 17306) 872s; run: log: (pid 17334) 869s
run: puma: (pid 17665) 754s; run: log: (pid 17674) 753s
run: redis: (pid 17168) 894s; run: log: (pid 17188) 891s
run: sidekiq: (pid 17697) 748s; run: log: (pid 17706) 747s

[root@gitlab ~]# gitlab-ctl restart #Gitlab重启

修改登录密码#

在gitlab14版本以上,会有默认的root用户,密码存在

/etc/gitlab/initial_root_password

image-20240915220802590

访问页面

如果出现 502 错误 检查服务器的时间是否正确,时间不正确执行以下命令

[root@gitlab ~]# yum -y install ntp
[root@gitlab ~]# ntpdate cn.pool.ntp.org
# 查看密码
[root@gitlab ~]# cat /etc/gitlab/initial_root_password
image-20240915222046069 image-20240915222339580 image-20240915222439557 image-20240915222602215

安装完毕!

posted @   BoForest  阅读(4)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~
点击右上角即可分享
微信分享提示
目录