1.gitlab

时间:2021-09-19
本文章向大家介绍1.gitlab,主要包括1.gitlab使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1 GitLab安装

1.1准备

# 安装依赖
yum install -y curl policycoreutils-python openssh-server postfix

# 启动SSH和postfix
systemctl enable sshd
systemctl start sshd
systemctl enable postfix
systemctl start postfix

1.2安装

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

2 .初始化配置

GitLab默认的配置文件路径:/etc/gitlab/

  • /etc/gitlab/gitlab.rb:主配置文件,包含外部URL、仓库目录、备份目录等
  • /etc/gitlab/gitlab-secrets.json:(执行gitlab-ctl reconfigure命令行后生成),包含各类密钥的加密信息

2.1 初始化配置

  • 配置首页地址(需将设置的域名DNS解析到服务器IP,或者修改本地host将域名指向服务器IP)
  • 修改服务端口,避免和其他服务端口冲突
  • 重新配置并启动,使配置生效,并确认相关组件或进程的状态
  • 设置账号密码和管理员信息
vim /etc/gitlab/gitlab.rb
#添加如下配置
external_url 'http://192.168.52.129'
unicorn['listen'] = '192.168.52.129'
unicorn['port'] = 8081

#初始化gitlab相关服务并完成安装
gitlab-ctl reconfigure

[root@yanglin1 ~]# gitlab-ctl status
run: alertmanager: (pid 27213) 2032s; run: log: (pid 24592) 2519s
run: gitaly: (pid 27129) 2038s; run: log: (pid 16020) 2675s
run: gitlab-exporter: (pid 27170) 2036s; run: log: (pid 23486) 2542s
run: gitlab-workhorse: (pid 27154) 2037s; run: log: (pid 21663) 2566s
run: grafana: (pid 27234) 2031s; run: log: (pid 27037) 2086s
run: logrotate: (pid 22169) 2557s; run: log: (pid 22431) 2554s
run: nginx: (pid 21739) 2563s; run: log: (pid 21764) 2562s
run: node-exporter: (pid 27163) 2037s; run: log: (pid 22753) 2550s
run: postgres-exporter: (pid 27225) 2031s; run: log: (pid 25586) 2515s
run: postgresql: (pid 16133) 2663s; run: log: (pid 16148) 2659s
run: prometheus: (pid 27188) 2034s; run: log: (pid 24311) 2529s
run: redis: (pid 15971) 2685s; run: log: (pid 15982) 2682s
run: redis-exporter: (pid 27179) 2035s; run: log: (pid 24175) 2536s
run: sidekiq: (pid 21488) 2575s; run: log: (pid 21522) 2574s
run: unicorn: (pid 18305) 2581s; run: log: (pid 18476) 2580s

 

2.2 登录

http://192.168.52.129   注意:这个地址是“external_url 'http://192.168.52.129'”
首次登录显示为密码设置界面,设置管理员密码,管理员账号默认username是root
设置完成之后,刷新即可使用root账号登录,登陆后会进入欢迎界面。

点击右上方+ → New porjectProject name输入test-repo,Visibility Level选择默认的Private即可,最后点击Create project创建项目。

2.3 gitlab工作流程

原文地址:https://www.cnblogs.com/hbxZJ/p/15312744.html