GitLab CE安装
安装比较简单,rpm直接在不同平台安装
1
|
https:
//about
.gitlab.com
/installation/
|
直接下载源包地址
https://about.gitlab.com/downloads/archives/
1
2
3
4
5
6
|
安装
#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加载配置与启动
1
2
|
#gitlab-ctl reconfigure
#gitlab-ctl start/restart
|
GitLab日志查看
1
2
|
#gitlab-ctl tail nginx
#gitlab-ctl tail unicorn
|
GitLab CE 备份与恢复
备份
1
2
3
4
5
|
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
。
恢复
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# 停止需要连接数据库的服务
#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
1
2
3
4
5
6
|
## 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, 修改参照以下
1
2
3
4
|
# /etc/gitlab/gitlab.rb
......
git_data_dirs({
"default"
=> {
"path"
=>
"</data/gitlab/git-data>"
,
'gitaly_address'
=>
'unix:/var/opt/gitlab/gitaly/gitaly.socket'
} })
......
|
本文转自 jackjiaxiong 51CTO博客,原文链接:http://blog.51cto.com/xiangcun168/1951028