天天看点

记一次 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、安装基本工具

[[email protected] ~]# yum install -y curl policycoreutils-python openssh-server openssh-clirnts postfixcronie lokkit rpm

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

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

临时关闭 SELINUX

[[email protected] ~]# setenforce 0

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

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

其他防火墙操作请参考

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

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

[[email protected] ~]# systemctl enable sshd

[[email protected] ~]# systemctl start sshd

[[email protected] ~]# systemctl enable postfix

[[email protected] ~]# systemctl start postfix

[[email protected] ~]# lokkit -s http -s ssh

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

[[email protected] ~]# mkdir /opt/gitlab

[[email protected] ~]# cd /opt/gitlab

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

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

记一次 Centos7 安装 GitLab CE v12.6.1

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

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

参考:

记一次 Centos7 安装 GitLab CE v12.6.1

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

记一次 Centos7 安装 GitLab CE v12.6.1

7、执行安装  gitlab-ce

[[email protected] gitlab]# yum install gitlab-ce-12.6.1-ce.0.el7.x86_64.rpm -y

记一次 Centos7 安装 GitLab CE v12.6.1
记一次 Centos7 安装 GitLab CE v12.6.1

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

记一次 Centos7 安装 GitLab CE v12.6.1

手动下载

[[email protected] 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

[[email protected] ~]# vim /etc/gitlab/gitlab.rb

记一次 Centos7 安装 GitLab CE v12.6.1

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

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

记一次 Centos7 安装 GitLab CE v12.6.1

9、重载配置信息

[[email protected] ~]# gitlab-ctl reconfigure

记一次 Centos7 安装 GitLab CE v12.6.1
记一次 Centos7 安装 GitLab CE v12.6.1

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

(1)停止服务

[[email protected] ~]# gitlab-ctl stop

记一次 Centos7 安装 GitLab CE v12.6.1

(2)启动服务

[[email protected] ~]# gitlab-ctl start

(3)重启服务

[[email protected] ~]# gitlab-ctl restart

记一次 Centos7 安装 GitLab CE v12.6.1

11、查看日志

[[email protected] ~]# gitlab-ctl tail

记一次 Centos7 安装 GitLab CE v12.6.1
记一次 Centos7 安装 GitLab CE v12.6.1

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

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

记一次 Centos7 安装 GitLab CE v12.6.1
记一次 Centos7 安装 GitLab CE v12.6.1
记一次 Centos7 安装 GitLab CE v12.6.1

13、汉化配置

记一次 Centos7 安装 GitLab CE v12.6.1

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 操作完毕!

继续阅读