Git/gitlab/centos gitlab

来自康健生活
Kangkk​(留言 | 贡献)2020年2月23日 (日) 08:34的版本 (创建页面,内容为“== centos gitlab == === 配置yum源 === <syntaxhighlight lang="bash"> vi /etc/yum.repos.d/gitlab-ce.repo</syntaxhighlight> <pre> [gitlab-ce] name=Gitlab CE Reposi…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

centos gitlab

配置yum源

vi /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/](https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/)
gpgcheck=0
enabled=1

更新缓存并安装

yum makecache
yum install gitlab-ce

配置启动

vi /etc/gitlab/gitlab.rb
external_url 'http://localhost:90'      //修改访问端口
gitlab-ctl reconfigure
gitlab-ctl start/stop/restart

备份和恢复

日常备份

gitlab-rake gitlab:backup:create

备份文件会保存在/var/opt/gitlab/backups下面。并且以_gitlab_backup.tar结尾。

拷贝相应的文件到需要恢复的机器的/var/opt/gitlab/backups目录下面。 恢复备份,其中有两个提示,都输入yes。包含账户信息都会被回复。

gitlab-rake gitlab:backup:restore BACKUP=1502357536_2017_08_10_9.4.3

其中遇到的问题: 在安装后执行reconfigure的时候有问题,提示8889端口正在被使用。那是因为卸载的时候不完全导致的。之前的程序还是运行。查出来kill掉就好。

卸载

可能安装不成功会需要卸载。卸载需要先删除包,再停止gitlab,不然会一直重启。最后删除其他配置文件。

gitlab-ctl stop
rpm -e gitlab-ce
ps -ef|grep gitlab //杀掉runsvdir -P /opt/gitlab/service log
find / -name *gitlab*|xargs rm -rf