Gitlab 简明安装配置指南

Posted by Turingdo Studio on August 7, 2017

参考文章

  1. CentOS服务器上搭建Gitlab安装步骤、中文汉化详细步骤、日常管理以及异常故障排查

  2. GitLab 简明安装配置指南

一 . 服务器快速搭建gitlab方法

可以参考gitlab中文社区 的教程 centos7安装gitlab:https://www.gitlab.cc/downloads/#centos7 centos6安装gitlab:https://www.gitlab.cc/downloads/#centos6 如下方法按照官网来操作,手工安装过于麻烦。当前测试平台为小鸟云的三个月centos 7测试机.

  1. 安装配置依赖项

如想使用Postfix来发送邮件,在安装期间请选择’Internet Site’. 您也可以用sendmai或者 配置SMTP服务 并 使用SMTP发送邮件. 在 Centos 6 和 7 系统上, 下面的命令将在系统防火墙里面开放HTTP和SSH端口.

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

这里可以自己yum 一个iptables做处理,一样的效果。

  1. 添加GitLab仓库,并安装到服务器上
curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce

如果你不习惯使用命令管道的安装方式, 你可以在这里下载 安装脚本 或者 手动下载您使用的系统相应的安装包(RPM/Deb) 然后安装

curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-XXX.rpm
rpm -i gitlab-ce-XXX.rpm

个人平时采用的是rpm安装,单独访问(内核7.x)https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7或(内核6.x)https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6,选择需要的版本进行安装,老版本用习惯了,用的是一种情怀,有些功能新版本不是很喜欢用,请根据自己个人喜好来安装。

  1. 启动GitLab
    sudo gitlab-ctl reconfigure
    

二 .gitlab中文汉化【如不清楚gitlab版本以及git,请不要操作,否则gitlab瘫痪】

这里取消,个别朋友由于版本原因进行汉化操作导致系统瘫痪,这里取消操作记录。

三 .日常管理

gitlab-ctl start|stop|status|restart 比如查看状态:

[root@21yunwei gitlab]# gitlab-ctl status
run: gitlab-workhorse: (pid 19922) 665s; run: log: (pid 19159) 725s
run: logrotate: (pid 19179) 723s; run: log: (pid 19178) 723s
run: nginx: (pid 19166) 724s; run: log: (pid 19165) 724s
run: postgresql: (pid 19026) 760s; run: log: (pid 19025) 760s
run: redis: (pid 18943) 766s; run: log: (pid 18942) 766s
run: sidekiq: (pid 19149) 732s; run: log: (pid 19148) 732s
run: unicorn: (pid 20257) 642s; run: log: (pid 19116) 734s