安装与配置

环境:centos7
http://www.jianshu.com/p/7a0d6917e009
http://blog.csdn.net/orangeann/article/details/45040227
http://blog.csdn.net/wmq880204/article/details/70141771?locationNum=11&fps=1--ci

  • 安装依赖
sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
  • 下载rpm包:https://packages.gitlab.com/gitlab/gitlab-ce
  • 解压:rpm -ivh xxx.rpm
安装与配置_第1张图片
Paste_Image.png
  • 启动
sudo gitlab-ctl reconfigure
  • 查看运行状态
[root@localhost ~]# sudo gitlab-ctl status
run: gitaly: (pid 5132) 237s; run: log: (pid 4864) 275s
run: gitlab-monitor: (pid 5182) 235s; run: log: (pid 5074) 249s
run: gitlab-workhorse: (pid 5142) 237s; run: log: (pid 4885) 269s
run: logrotate: (pid 4915) 266s; run: log: (pid 4914) 266s
run: nginx: (pid 4894) 268s; run: log: (pid 4893) 268s
run: node-exporter: (pid 5019) 259s; run: log: (pid 5018) 259s
run: postgres-exporter: (pid 5169) 236s; run: log: (pid 5046) 255s
run: postgresql: (pid 4687) 319s; run: log: (pid 4686) 319s
run: prometheus: (pid 5157) 236s; run: log: (pid 5002) 260s
run: redis: (pid 4630) 326s; run: log: (pid 4629) 326s
run: redis-exporter: (pid 5033) 257s; run: log: (pid 5032) 257s
run: sidekiq: (pid 4855) 277s; run: log: (pid 4854) 277s
run: unicorn: (pid 4823) 278s; run: log: (pid 4822) 278s

配置

  • 修改IP地址
1.进入/etc/gitlab/gitlab.rb
2.修改 external_url 'http://localhost'为指定地址
3.重启 sudo gitlab-ctl reconfigure
4.访问 http://xxx.xxx.xx.xx/
  • 备份
    一些属性gitlab.rb:
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" #备份目录
gitlab_rails['backup_archive_permissions'] = 0644 #生成的文件权限
gitlab_rails['backup_keep_time'] = 864000  #保留10天

1 备份配置文件

2 备份数据文件
默认备份地址:/var/opt/gitlab/backups
修改备份地址:

vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml(或者修改gitlab.rb)
path改为: path: "/usr/local/src/repositories",执行重启命令后执行备份
[root@localhost ~]# gitlab-rake gitlab:backup:create
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]//当中省略
done
Deleting old backups ... skipping

定时备份:
cron表达式

# Minute   Hour   Day of Month       Month          Day of Week        Command    
# (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)                
    0        2          12             *                *            /usr/bin/find

运行

执行:crontab -e
# 每天17点40分点执行备份
40 17 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
  • 恢复
    1 恢复配置文件
    2 恢复数据文件
sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/
# 停止连接数据库的进程
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# 恢复1393513186这个备份文件,将覆盖GitLab数据库!
sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186
# 启动 GitLab
sudo gitlab-ctl start
# 检查 GitLab
sudo gitlab-rake gitlab:check SANITIZE=true
  • 持续集成(GitLab-CI)

你可能感兴趣的:(安装与配置)