记一次 Centos7 安装 GitLab CE v12.6.1

一、简介

GitLab 是一个用于仓库管理系统的开源项目,是由GitLabInc.开发,使用MIT许可证的基于网络的Git仓库管理工具,且具有wiki和issue跟踪功能。使用Git作为代码管理工具,并在此基础上搭建起来的web服务。

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

官方文档:https://docs.gitlab.com/

二、环境、工具说明

1、操作系统  Centos7.4 x64  Minimal 1708

安装1台虚拟机:4G内存  1核CPU

2、工具:xshell5

3、VMware 版本:VMware Workstation Pro15

三、安装、部署

1、安装虚拟机并配置虚拟机网络

(1)虚拟机安装过程参考: https://blog.csdn.net/llwy1428/article/details/89328381

(2)虚拟机网络配置过程: https://blog.csdn.net/llwy1428/article/details/85058028

2、安装基本工具

[root@controller ~]# yum install -y curl policycoreutils-python openssh-server openssh-clirnts postfixcronie lokkit rpm

3、永久关闭 SELINUX(重启生效)

https://blog.csdn.net/llwy1428/article/details/100938748

临时关闭 SELINUX

[root@controller ~]# setenforce 0

4、关闭防火墙(或开启指定端口)

关闭防火墙    : systemctl stop firewalld
查看状态      : systemctl status firewalld
开机禁用      : systemctl disable firewalld

其他防火墙操作请参考

https://blog.csdn.net/llwy1428/article/details/99676257

5、使用 lokkit 命令设置防火墙,打开 HTTP 和 SSH 的访问权限

[root@controller ~]# systemctl enable sshd

[root@controller ~]# systemctl start sshd

[root@controller ~]# systemctl enable postfix

[root@controller ~]# systemctl start postfix

[root@controller ~]# lokkit -s http -s ssh

6、创建目录,下载安装包

[root@controller ~]# mkdir /opt/gitlab

[root@controller ~]# cd /opt/gitlab

下载  gitlab-ce-12.6.1-ce.0.el7.x86_64.rpm  安装包(可手动下载)

下载地址:https://packages.gitlab.com/gitlab/gitlab-ce/

下载后,把文件 gitlab-ce-12.6.1-ce.0.el7.x86_64.rpm 放在 /opt/gitlab/ 目录下,执行第 7 步。

(也可执行官网的安装命令)

参考:

[root@controller gitlab]# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

7、执行安装  gitlab-ce

[root@controller gitlab]# yum install gitlab-ce-12.6.1-ce.0.el7.x86_64.rpm -y

如出现安装失败的情况,如下:

手动下载

[root@localhost gitlab]# wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-12.9.10-ce.0.el7.x86_64.rpm/download.rpm

8、修改配置文件 gitlab-ce

[root@controller ~]# vim /etc/gitlab/gitlab.rb

unicorn['port'] 建议修改,否则再次启动服务的时候会报  “502” 错误,导致系统无法登录。

(端口不和系统现有已运行服务端口冲突即可)

9、重载配置信息

[root@controller ~]# gitlab-ctl reconfigure

10、启动、停止、重启服务

(1)停止服务

[root@controller ~]# gitlab-ctl stop

(2)启动服务

[root@controller ~]# gitlab-ctl start

(3)重启服务

[root@controller ~]# gitlab-ctl restart

11、查看日志

[root@controller ~]# gitlab-ctl tail

12、浏览器登录,设置初始密码

浏览器地址栏录入:http://192.168.11.61  (192.168.11.61 是我虚拟机的 IP)

13、汉化配置

14、有可能遇到的问题及解决方案

(1)Gitlab 登录  502 错误

解决方案:

a.修改/etc/gitlab/gitlab.rb 

unicorn[‘port’] = 8888    (不和其他服务端口冲突即可)

再gitlab-ctl reconfigure 重启配置,这样GitLab服务器就可以正常运行了。

b、官方建议 

sudo gitlab-ctl restart sidekiq 

sudo gitlab-ctl hup unicorn

15、GitLab 操作(使用教程)

https://blog.csdn.net/justlpf/article/details/80681853

至此, Centos7  安装 GitLab CE v12.6.1 操作完毕!

猜你喜欢

转载自blog.csdn.net/llwy1428/article/details/103782173