1、介绍

一个基于GIT的源码托管解决方案
基于Ruby on rails开发
集成了nginx postgreSQL redis sidekiq等组件

2、资源

官网
https://about.gitlab.com/downloads

清华镜像
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

3、安装要求

  • 虚拟机centos7 64位
  • 内存2G+
  • 安装版本gitlab_ce_9.0.4

4、安装依赖

yum install curl policycoreutils openssh-server openssh-clients -y
#yum install policycoreutils-python -y      # centos 7 安装gitlab-ce-11.7.7-ce.0.el7.x86_64.rpm 需要这个依赖
systemctl enable sshd
systemctl start sshd
yum install postfix -y
systemctl enable postfix
systemctl start postfix
firewall-cmd --permanent --add-service=http
systemctl reload firewalld

5、执行安装

rpm -ivh gitlab-ce-9.0.4-ce.0.el7.x86_64.rpm

修改配置文件 /etc/gitlab/gitlab.rb

gitlab-ctl reconfigure

http://{{ip}}
默认用户

root
5iveL!fe

6、常用命令

gitlab-ctl status
gitlab-ctl start
gitlab-ctl stop
gitlab-ctl restart
gitlab-ctl tail nginx

7、CentOS7安装详细演示

[root@linux-node4 ~]# yum install curl policycoreutils openssh-server openssh-clients -y
[root@linux-node4 ~]# yum install postfix -y
[root@linux-node4 ~]# systemctl enable postfix
[root@linux-node4 ~]# systemctl start postfix
[root@linux-node4 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.9.5-ce.0.el7.x86_64.rpm
[root@linux-node4 ~]# rpm -ivh gitlab-ce-8.9.5-ce.0.el7.x86_64.rpm
[root@linux-node4 ~]# sed -i s#$(hostname)#$(ifconfig -a|grep -o -e 'inet [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}'|grep -v "127.0.0"|awk '{print $2}')#g /etc/gitlab/gitlab.rb
[root@linux-node4 ~]# grep -Ev "^#|^$" /etc/gitlab/gitlab.rb
external_url 'http://192.168.6.243'
[root@linux-node4 ~]# gitlab-ctl reconfigure

默认用户及默认密码:

root
5iveL!fe

首次访问GitLab,系统会让你重新设置管理员的密码,设置成功后会返回登录界面.
默认的管理员账号是root,如果你想更改默认管理员账号,请输入上面设置的新密码登录系统后修改帐号名.

8、Gitlab组件

  • nginx:静态Web服务器
  • gitlab-shell:用于处理Git命令和修改authorized keys列表
  • gitlab-workhorse:轻量级的反向代理服务器
  • logrotate:日志文件管理工具
  • postgresql:数据库
  • redis:缓存数据库
  • sidekiq:用于在后台执行队列任务(异步执行)
  • unicorn:GitLab Rails应用是托管在这个服务器上面的。

9、目录

  • /var/opt/gitlab/git-data/repositories/root:库默认存储目录
  • /opt/gitlab:应用代码和相应的依赖程序
  • /var/opt/gitlab:gitlab-ctl reconfigure命令编译后的应用数据和配置文件,不需要人为修改配置
  • /etc/gitlab:配置文件目录
  • /var/log/gitlab:此目录下存放了gitlab各个组件产生的日志
  • /var/opt/gitlab/backups/:备份文件生成的目录

10、变更主配置文件

需要以下操作

1、gitlab-ctl reconfigure                  重置配置文件
2、gitlab-ctl show-config                  验证配置文件
3、gitlab-ctl restart                      重启gitlab服务

sourcetree下载:
https://www.sourcetreeapp.com/download-archives

文档更新时间: 2019-03-29 16:09   作者:李延召