环境:
Os:Centos 7
gitlab:17.1
1.配置yum源
vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
2.安装gitlab社区版
#自动安装最新版本并安装相关依赖
yum install -y curl policycoreutils policycoreutils-python openssh-server openssh-clients postfix
yum install gitlab-ce
Running transactionInstalling : gitlab-ce-17.1.1-ce.0.el7.x86_64 1/1
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 reconfigureFor 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=17-1
Verifying : gitlab-ce-17.1.1-ce.0.el7.x86_64 1/1 Installed:gitlab-ce.x86_64 0:17.1.1-ce.0.el7 Complete!
3.配置
vi /etc/gitlab/gitlab.rb
external_url 'http://192.168.1.105:8888'
注意这里不能使用8080端口,该端口与puma产生冲突,我这里使用8888端口
重新应用配置
gitlab-ctl reconfigure
gitlab-ctl restart ##可以不需要
最后输出如下信息:
gitlab Reconfigured!
4.查看状态
[root@node1 gitlab]# gitlab-ctl status
run: alertmanager: (pid 23092) 51s; run: log: (pid 23108) 50s
run: gitaly: (pid 21772) 220s; run: log: (pid 21788) 219s
run: gitlab-exporter: (pid 22914) 69s; run: log: (pid 22940) 68s
run: gitlab-kas: (pid 22063) 203s; run: log: (pid 22100) 200s
run: gitlab-workhorse: (pid 22765) 85s; run: log: (pid 22766) 85s
run: logrotate: (pid 21647) 232s; run: log: (pid 21678) 231s
run: nginx: (pid 22802) 82s; run: log: (pid 22816) 79s
run: node-exporter: (pid 22856) 75s; run: log: (pid 22864) 74s
run: postgres-exporter: (pid 23150) 45s; run: log: (pid 23157) 44s
run: postgresql: (pid 21869) 209s; run: log: (pid 21903) 208s
run: prometheus: (pid 23036) 57s; run: log: (pid 23045) 56s
run: puma: (pid 22630) 102s; run: log: (pid 22639) 98s
run: redis: (pid 21722) 226s; run: log: (pid 21735) 224s
run: redis-exporter: (pid 22949) 63s; run: log: (pid 22982) 62s
run: sidekiq: (pid 22668) 95s; run: log: (pid 22702) 91s
5.浏览器登录
http://192.168.1.105:8888
5.更改配置文件参数
gitlab组件日志路径:/var/log/gitlab
gitlab配置路径:/etc/gitlab/ 路径下有gitlab.rb配置文件
应用代码和组件依赖程序:/opt/gitlab
各个组件存储路径: /var/opt/gitlab/
仓库默认存储路径 /var/opt/gitlab/git-data/repositories
版本文件备份路径:/var/opt/gitlab/backups/
nginx安装路径:/var/opt/gitlab/nginx/
redis安装路径:/var/opt/gitlab/redis
6.其他命令
gitlab-ctl start #启动全部服务
gitlab-ctl restart#重启全部服务
gitlab-ctl stop #停止全部服务
gitlab-ctl restart nginx #重启单个服务,如重启nginx
gitlab-ctl status #查看服务状态
gitlab-ctl reconfigure #使配置文件生效
gitlab-ctl show-config #验证配置文件
gitlab-ctl uninstall #删除gitlab(保留数据)
gitlab-ctl cleanse #删除所有数据,从新开始
gitlab-ctl tail <service name>查看服务的日志
gitlab-ctl tail nginx #如查看gitlab下nginx日志
gitlab-rails console #进入控制台
gitlab-ctl help #查看gitlab帮助信息
7.彻底删除gitlab
gitlab-ctl stop
find / -name gitlab | xargs rm -rf