Gitlab安装配置与使用

1.    安装

操作系统使用Centos 6.564位,为保持与现有数据的一致性,Gitlab版本选用8.2.1,安装文件:gitlab-ce-8.2.1-ce.0.el6.x86_64.rpm

官方参考文档:https://about.gitlab.com/downloads/#centos6

 

1)    配置网络环境

新安装的Centos云主机,没有配置DNS,所以无法进行软件更新。

vi /etc/resolv.conf

添加如下代码:

nameserver 202.112.144.236

重启network服务:

/etc/init.d/network restart

2)    安装所需组件和服务

sudo yum install curl openssh-server openssh-clients postfix cronie 
sudo service postfix start
sudo chkconfig postfix on 
//前三条安装的软件和启动的服务在centos6上已经默认完成
sudo lokkit -s http -s ssh // 为http和ssh服务打开防火墙

3)    运行安装程序

       rpm–i gitlab-ce-8.2.1-ce.0.el6.x86_64.rpm

[root@gitlab ~]#rpm -i gitlab-ce-8.2.1-ce.0.el6.x86_64.rpm
hostname: 未知的主机
gitlab: Thankyou for installing GitLab!
gitlab: Toconfigure and start GitLab, RUN THE FOLLOWING COMMAND:
 
sudo gitlab-ctlreconfigure
 
gitlab: GitLabshould be reachable at http://gitlab.example.com
gitlab:Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rbfile
gitlab: Andrunning reconfigure again.
gitlab:
gitlab: For acomprehensive list of configuration options please see the Omnibus GitLabreadme
gitlab:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
It looks likeGitLab has not been configured yet; skipping the upgrade script.
[root@gitlab ~]#

4)    配置和启动

修改外网地址

打开/etc/gitlab/gitlab.rb,将其中external_url 'http://gitlab.example.com'修改为本机的IP地址


gitlab-ctl reconfigure

大约耗时一分多钟完成配置过程。

在浏览器中输入所在机器的ip,即可访问Gitlab登录页面,默认登录密码是root/5iveL!fe

登录后可更改默认密码。

 

2.    使用

如果需要恢复之前的数据文件,请先参考第三部分中的过程恢复已有数据。

使用部分待补充

 

3.    备份与恢复

参考官方文档:https://docs.gitlab.com/ce/raketasks/backup_restore.html

备份部分:

sudo gitlab-rakegitlab:backup:create

生成名为[TIMESTAMP]_gitlab_backup.tarbackup文件,路径位于/var/opt/gitlab/backups下。

 

恢复部分:

检查前提条件是否满足:

1) 备份和恢复的Gitlab程序版本一致

2) 至少运行过一次gitlab-ctl reconfigure命令

3) GitLab处于运行状态,不是的话通过gitlab-ctlstart进行启动

 

开始恢复:

1) 将数据文件拷贝至gitlab的backups目录:

[root@gitlab ~]# cp 1482805486_gitlab_backup.tar/var/opt/gitlab/backups/

2) 停止访问数据库的两个服务

sudogitlab-ctl stop unicorn

sudogitlab-ctl stop sidekiq

# Verify

sudo gitlab-ctl status

3) 执行恢复操作

[root@gitlab backups]# gitlab-rake gitlab:backup:restoreBACKUP=1482805486

4) 启动服务并进行检查

gitlab-ctl start

gitlab-rake gitlab:check SANITIZE=true

 

[root@gitlabbackups]# gitlab-ctl start
ok: run:gitlab-workhorse: (pid 4164) 2313s
ok: run:logrotate: (pid 4005) 2362s
ok: run:nginx: (pid 3932) 2368s
ok: run:postgresql: (pid 3684) 2422s
ok: run:redis: (pid 3542) 2433s
ok: run:sidekiq: (pid 7060) 0s
ok: run:unicorn: (pid 7064) 1s
[root@gitlabbackups]# gitlab-rake gitlab:check SANITIZE=true
CheckingGitLab Shell ...
 
GitLabShell version >= 2.6.8 ? ... OK (2.6.8)
Repo basedirectory exists? ... yes
Repo basedirectory is a symlink? ... no
Repo baseowned by git:git? ... yes
Repo baseaccess is drwxrws---? ... no
  Try fixing it:
  sudo chmod -R ug+rwX,o-rwx/var/opt/gitlab/git-data/repositories
  sudo chmod -R ug-s/var/opt/gitlab/git-data/repositories
  find /var/opt/gitlab/git-data/repositories-type d -print0 | sudo xargs -0 chmod g+s
  For more information see:
  doc/install/installation.md in section"GitLab Shell"
  Please fix the error above and rerun thechecks.
hooksdirectories in repos are links: ...
2/7 ...ok
3/8 ...ok
3/9 ...ok
2/10 ...ok
4/11 ...ok
2/12 ...ok
2/13 ...ok
2/14 ...ok
4/15 ...ok
2/16 ...ok
Running/opt/gitlab/embedded/service/gitlab-shell/bin/check
CheckGitLab API access: OK
Check directoriesand files:
  /var/opt/gitlab/git-data/repositories: OK
  /var/opt/gitlab/.ssh/authorized_keys: OK
Testredis-cli executable: redis-cli 2.8.21
Send pingto redis server: PONG
gitlab-shellself-check successful
 
CheckingGitLab Shell ... Finished
 
CheckingSidekiq ...
 
Running?... yes
Number ofSidekiq processes ... 1
 
CheckingSidekiq ... Finished
 
CheckingReply by email ...
 
Reply byemail is disabled in config/gitlab.yml
 
CheckingReply by email ... Finished
 
CheckingLDAP ...
 
LDAP isdisabled in config/gitlab.yml
 
CheckingLDAP ... Finished
 
CheckingGitLab ...
 
Gitconfigured with autocrlf=input? ... yes
Databaseconfig exists? ... yes
Databaseis SQLite ... no
Allmigrations up? ... yes
Databasecontains orphaned GroupMembers? ... no
GitLabconfig exists? ... yes
GitLabconfig outdated? ... no
Logdirectory writable? ... yes
Tmpdirectory writable? ... yes
Uploadsdirectory setup correctly? ... skipped (no tmp uploads folder yet)
Initscript exists? ... skipped (omnibus-gitlab has no init script)
Initscript up-to-date? ... skipped (omnibus-gitlab has no init script)
projectshave namespace: ...
2/7 ...yes
3/8 ...yes
3/9 ...yes
2/10 ...yes
4/11 ...yes
2/12 ...yes
2/13 ...yes
2/14 ...yes
4/15 ...yes
2/16 ...yes
Redisversion >= 2.4.0? ... yes
Rubyversion >= 2.1.0 ? ... yes (2.1.7)
Your gitbin path is "/opt/gitlab/embedded/bin/git"
Gitversion >= 1.7.10 ? ... yes (2.6.1)
Activeusers: 22
 
CheckingGitLab ... Finished
 
[root@gitlab backups]#  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值