欢迎光临
我们一直在努力

Centos7安装配置Gitlab-CE

gitlab介绍

GitLab:是一个基于Git实现的在线代码仓库托管软件,你可以用gitlab自己搭建一个类似于Github一样的系统,一般用于在企业、学校等内部网络搭建git私服。
功能:Gitlab 是一个提供代码托管、提交审核和问题跟踪的代码管理平台。对于软件工程质量管理非常重要。
版本:GitLab 分为社区版(CE) 和企业版(EE)。
配置:建议CPU2核,内存2G以上。

Gitlab的服务构成:

Nginx:静态web服务器。
gitlab-shell:用于处理Git命令和修改authorized keys列表。(Ruby)
gitlab-workhorse: 轻量级的反向代理服务器。(go)

GitLab Workhorse是一个敏捷的反向代理。它会处理一些大的HTTP请求,比如文件上传、文件下载、Git push/pull和Git包下载。其它请求会反向代理到GitLab rails应用,即反向代理给后端的unicorn。

logrotate:日志文件管理工具。
postgresql:数据库。
redis:缓存数据库。
sidekiq:用于在后台执行队列任务(异步执行)。(Ruby)
unicorn:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。(Ruby Web Server,主要使用Ruby编写)

GitLab安装

1.源码安装

2.yum安装

官方源地址:https://about.gitlab.com/downloads/#centos6
清华大学镜像源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce

cat> /etc/yum.repos.d/gitlab-ce.repo<< EOF [gitlab-ce] name=Gitlab CE Repository baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/  gpgcheck=0 enabled=1 EOF

安装依赖

yum install curl policycoreutils-python openssh-server
 

再执行

 yum makecache yum install gitlab-ce gitlab-ctl reconfigure #Configure and start GitLab

更改访问地址url

vim /etc/gitlab/gitlab.rb

Centos7安装配置Gitlab-CE

配置邮件:

Centos7安装配置Gitlab-CE

 1 gitlab_rails['smtp_enable'] = true  2 gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"  3 gitlab_rails['smtp_port'] = 465  4 gitlab_rails['smtp_user_name'] = "########.cn"  5 gitlab_rails['smtp_password'] = "#########"  6 gitlab_rails['smtp_authentication'] = "login"  7 gitlab_rails['smtp_enable_starttls_auto'] = true  8 gitlab_rails['smtp_tls'] = true  9 gitlab_rails['gitlab_email_from'] = '##########' 10 gitlab_rails['smtp_domain'] = "exmail.qq.com"

 

配置生效

1  #使配置生效 2 gitlab-ctl reconfigure 3  #重新启动GitLab 4 gitlab-ctl restart

 

GitLab备份和恢复

备份

# 可以将此命令写入crontab,以实现定时备份 /usr/bin/gitlab-rake gitlab:backup:create


#备份的数据会存储在/var/opt/gitlab/backups,用户通过自定义参数 gitlab_rails['backup_path'],改变默认值。

恢复

 1 # 停止unicorn和sidekiq,保证数据库没有新的连接,不会有写数据情况  2 sudo gitlab-ctl stop unicorn  3 sudo gitlab-ctl stop sidekiq  4  5  # 进入备份目录进行恢复,1476900742为备份文件的时间戳  6 cd /var/opt/gitlab/backups  7 gitlab-rake gitlab:backup:restore BACKUP=1476900742  8 cd -  9 10  # 启动unicorn和sidekiq 11 sudo gitlab-ctl start unicorn 12 sudo gitlab-ctl start sidekiq

GitLab常用命令

1 gitlab-ctl start # 启动所有 gitlab 组件; 2 gitlab-ctl stop # 停止所有 gitlab 组件; 3 gitlab-ctl restart # 重启所有 gitlab 组件; 4 gitlab-ctl status # 查看服务状态; 5 vim /etc/gitlab/gitlab.rb # 修改gitlab配置文件; 6 gitlab-ctl reconfigure # 重新编译gitlab的配置; 7 gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab; 8 gitlab-ctl tail # 查看日志; 9 gitlab-ctl tail nginx/gitlab_access.log

注意:执行 reconfigure 命令会把gitlab的nginx组件的配置还原,导致自定义修改的端口以及域名等都没有了。

 

  • 海报
海报图正在生成中...
赞(0) 打赏
声明:
1、本博客不从事任何主机及服务器租赁业务,不参与任何交易,也绝非中介。博客内容仅记录博主个人感兴趣的服务器测评结果及一些服务器相关的优惠活动,信息均摘自网络或来自服务商主动提供;所以对本博客提及的内容不作直接、间接、法定、约定的保证,博客内容也不具备任何参考价值及引导作用,访问者需自行甄别。
2、访问本博客请务必遵守有关互联网的相关法律、规定与规则;不能利用本博客所提及的内容从事任何违法、违规操作;否则造成的一切后果由访问者自行承担。
3、未成年人及不能独立承担法律责任的个人及群体请勿访问本博客。
4、一旦您访问本博客,即表示您已经知晓并接受了以上声明通告。
文章名称:《Centos7安装配置Gitlab-CE》
文章链接:https://www.456zj.com/38341.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址