gitlab搭建

gitlab官方安装文档地址 https://about.gitlab.com/install/

一、系统环境
1.系统版本
[root@gitlab ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

2.内存
[root@gitlab ~]# free -m
total used free shared buff/cache available
Mem: 3934 107 3696 11 130 3625
Swap: 1023 0 1023

3.IP
[root@gitlab ~]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:60:5b:13 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.70/24 brd 10.0.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe60:5b13/64 scope link
valid_lft forever preferred_lft forever


二、安装步骤
1.安装依赖包
#安装依赖包
[root@gitlab ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python

#启动postfix
[root@gitlab ~]# systemctl start postfix && systemctl enable postfix

2.下载gitlab安装包并安装
#从清华大学镜像源下载
[root@gitlab ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm

#安装bitlab
[root@gitlab ~]# yum -y localinstall gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm

3.安装git
[root@gitlab ~]# yum -y install git

4.修改gitlab配置文件
[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
修改13行 xternal_url 'http://gitlab.example.com'
修改为本机IP地址
external_url 'http://10.0.0.70'

#说明
/opt/gitlab #gitlab的程序安装目录
/var/opt/gitlab #gitlab目录数据目录
/var/opt/gitlab/git-dfata #存放仓库数据

5.启动gitlab
#启动gitlab
[root@gitlab ~]# gitlab-ctl start

#重载gitlab配置文件
[root@gitlab ~]# gitlab-ctl reconfigure

重载完成后会提示如下
Running handlers:
Running handlers complete
Chef Client finished, 473/1265 resources updated in 03 minutes 25 seconds
gitlab Reconfigured!

#gitlab启动的端口
[root@gitlab ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 3456/nginx: master
tcp 0 0 127.0.0.1:9121 0.0.0.0:* LISTEN 3901/redis_exporter
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 3913/prometheus
tcp 0 0 127.0.0.1:9187 0.0.0.0:* LISTEN 3960/postgres_expor
tcp 0 0 127.0.0.1:9093 0.0.0.0:* LISTEN 3946/alertmanager
tcp 0 0 127.0.0.1:9100 0.0.0.0:* LISTEN 3881/node_exporter
tcp 0 0 127.0.0.1:9229 0.0.0.0:* LISTEN 3858/gitlab-workhor
tcp 0 0 127.0.0.1:9168 0.0.0.0:* LISTEN 3891/puma 3.12.0 (t
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 3360/unicorn master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3456/nginx: master
tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN 3397/sidekiq 5.2.5
tcp 0 0 127.0.0.1:9236 0.0.0.0:* LISTEN 3841/gitaly
tcp6 0 0 :::9094 :::* LISTEN 3946/alertmanager
tcp6 0 0 ::1:9168 :::* LISTEN 3891/puma 3.12.0 (t

#gitlab相关命令
gitlab-ctl status #查看目前gitlab所有服务运维状态
gitlab-ctl stop #停止gitlab服务
gitlab-ctl stop nginx #单独停止某个服务
gitlab-ctl tail #查看所有服务的日志

6.gitlab汉化
#下载最新汉化包
[root@gitlab 1]# git clone https://gitlab.com/xhang/gitlab.git

#下载gitlab对应版本汉化包,下载后是一个gitlab名称的目录
[root@gitlab ~]# git clone https://gitlab.com/xhang/gitlab.git -b v10.2.2-zh
[root@gitlab ~]# ls

#切换到汉化包目录,比较汉化标签和原标签,导出patch用的diff文件到/root下
[root@gitlab ~]# cd gitlab
[root@gitlab gitlab]# git diff v12.0.4 v12.0.4-zh > ../12.0.4-zh.diff
[root@gitlab ~]# ls
12.0.4-zh.diff

#将11.8.3-zh.diff作为补丁更新到gitlab中
[root@gitlab ~]# yum -y install patch
[root@gitlab ~]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 12.0.4-zh.diff
回车(忽略)
#重启gitlab并重载gitlab配置文件
[root@gitlab ~]# gitlab-ctl restart
[root@gitlab ~]# gitlab-ctl reconfigure

7.浏览器访问
如果浏览器访问出现502则再次重启gitlab并重载配置文件
设置密码,最少8位数

登陆gitlab,用户名为root,密码为自己设置的密码

登陆后首界面,有一部分没有汉化,汉化包的原因

******************************人因为有理想、梦想而变得伟大,而真正伟大就是不断努力实现理想、梦想*****************************
原文地址:https://www.cnblogs.com/cloudLi/p/12851217.html