GitLab CE安装
安装比较简单,rpm直接在不同平台安装
https://about.gitlab.com/installation/
直接下载源包地址
https://about.gitlab.com/downloads/archives/
安装
#yum install curl openssh-server openssh-clients postfix cronie
#service postfix start
#chkconfig postfix on
#lokkit -s http -s ssh
#rpm -i gitlab-ce-XXX.rpm
GitLab加载配置与启动
#gitlab-ctl reconfigure
#gitlab-ctl start/restart
GitLab日志查看
#gitlab-ctl tail nginx
#gitlab-ctl tail unicorn
GitLab CE 备份与恢复
备份
gitlab-rake gitlab:backup:create
可设置自动备份任务
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:creat
更改默认路径,可以在
/etc/gitlab/gitlab.rb
文件的
gitlab_rails['backup_path']
项中进行设置,默认为
/var/opt/gitlab/backups
。
恢复
# 停止需要连接数据库的服务
#gitlab-ctl stop unicorn
#gitlab-ctl stop sidekiq
# 恢复备份的数据,重写数据库内容
# GitLab 8.15 版本以前所用的时间戳格式为 EPOCH (1393513186)
#gitlab-rake gitlab:backup:restore BACKUP=1459620009
# 或# GitLab 8.15 版本以后所用的时间戳格式为 EPOCH_YYYY_MM_DD (1491415349_2017_04_06)
# gitlab-rake gitlab:backup:restore BACKUP=1491415349_2017_04_06
# 启动 GitLabsudo gitlab-ctl start
# 检查 GitLab 是否正常运行
#gitlab-rake gitlab:check SANITIZE=true
GitLab CE迁移与升级
迁移可参考备份与恢复,需要注意的是:版本号一定要一致
升级
跨版本升级在这里不过多介绍,如大版本9,升级过程下载相关安装包进行安装,自动会完成升级
GitLab CE 使用小节
1、项目地址为localhost
#vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: localhost
port: 80
https: false
2、merge 、chekout 出现以下错误:
GitLab: The project you were looking for could not be found.
此类错误多出现在git-data挂载软链接导致
如我的挂载 /var/opt/gitlab -> /data/gitlab, 修改参照以下
# /etc/gitlab/gitlab.rb
......
git_data_dirs({ "default" => { "path" => "</data/gitlab/git-data>", 'gitaly_address' => 'unix:/var/opt/gitlab/gitaly/gitaly.socket' } })
......