gitlab快速搭建方法


gitlab中文社区的教程 https://www.gitlab.com.cn/downloads/ 
GitLab中文文档 https://docs.gitlab.com.cn/omnibus/

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

[root@linux-node3 ~]# yum -y install curl policycoreutils openssh-server openssh-clients
[root@linux-node3 ~]# systemctl enable sshd
[root@linux-node3 ~]# systemctl start sshd
[root@linux-node3 ~]# yum -y install postfix
[root@linux-node3 ~]# systemctl enable postfix
[root@linux-node3 ~]# systemctl start postfix
[root@linux-node3 ~]# firewall-cmd --permanent --add-service=http
[root@linux-node3 ~]# systemctl reload firewalld
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

二、添加GitLab仓库,并安装到服务器上 
[root@Linux-node3 ~]# curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash 
[root@linux-node3 ~]# yum -y install gitlab-ce

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

[root@linux-node3 ~]# curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-XXX.rpm    
#这个是目前最新的安装包gitlab-ce-9.2.7-ce.0.el7.x86_64.rpm
[root@linux-node3 ~]# rpm -ivh gitlab-ce-XXX.rpm
   
   
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

三、启动GitLab

[root@linux-node3 ~]# gitlab-ctl reconfigure
   
   
  • 1
  • 1

访问:http://192.168.88.136:8081 
这里写图片描述

这里写图片描述

注意事项以及异常故障排查 
①按照该方式,我安装了一个确实没问题,只不过是英文版。没有经过汉化。 
②默认安装登录需要重置root密码。可以自己单独设置一个复杂密码后登录。 
③gitlab本身采用80端口,如安装前服务器有启用80,安装完访问会报错。需更改gitlab的默认端口。

[root@linux-node3 ~]# grep ^external_url /etc/gitlab/gitlab.rb
external_url 'http://192.168.88.136:8081'    #8081是自定义的端口
   
   
  • 1
  • 2
  • 1
  • 2

④unicorn本身采用8080端口,如安装前服务器有启用8080,安装完访问会报错。需更改unicorn的默认端口。

[root@linux-node3 ~]# grep ^unicorn /etc/gitlab/gitlab.rb
unicorn['listen'] = '192.168.88.136'
unicorn['port'] = 8080
   
   
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

这里写图片描述 
⑤每次重新配置,都需要执行 gitlab-ctl reconfigure 使之生效。 
⑥日志位置:/var/log/gitlab 可以进去查看访问日志以及报错日志等,供访问查看以及异常排查。

[root@linux-node3 ~]# gitlab-ctl tail                          #查看所有日志
[root@linux-node3 ~]# gitlab-ctl tail nginx/gitlab_access.log   #查看nginx访问日志
   
   
  • 1
  • 2
  • 1
  • 2

四、gitlab中文汉化【如不清楚gitlab版本以及Git,请不要操作,否则gitlab瘫痪】 
1、下载汉化包

[root@linux-node3 ~]# yum -y install git
[root@linux-node3 ~]# cd /usr/local/src
[root@linux-node3 src]# git clone https://github.com/larryli/gitlabhq.git
   
   
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

2、停止当前gitlab

[root@linux-node3 src]# gitlab-ctl stop
[root@linux-node3 src]# \cp  /usr/local/src/gitlabhq/*  /opt/gitlab/embedded/service/gitlab-rails/  -rf
   
   
  • 1
  • 2
  • 1
  • 2

其中有两个提示我们可以忽略:

cp: cannot overwrite non-directory ‘/opt/gitlab/embedded/service/gitlab-rails/logwith directorylog’
cp: cannot overwrite non-directory ‘/opt/gitlab/embedded/service/gitlab-rails/tmp’ with directory ‘tmp’
   
   
  • 1
  • 2
  • 1
  • 2

3、日常管理

[root@linux-node3 ~]# gitlab-ctl start|stop|status|restart
   
   
  • 1
  • 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值