记一次gitLab搭建(centerOS7版本)

270 阅读1分钟

前言

最近为公司搭建了一次gitlab,这里将安装步骤和遇到的一些问题整理于此

安装步骤

卸载本机gitliab以及相关文件

sudo gitlab-ctl uninstall
sudo rpm -e gitlab-ce
find / -name gitlab|xargs rm -rf

安装相关依赖

yum install curl openssh-server openssh-clients postfix cronie policycoreutils-python –y

启动postfix,并设置为开机启动

systemctl start postfix
systemctl enable postfix

防火墙设置

#此命令需在防火墙开启后使用
firewall-cmd --add-service=http --permanent
firewall-cmd --reload

获取安装包

1、清华镜像安装

新建 /etc/yum.repos.d/gitlab_gitlab-ce.repo,内容为:

[gitlab-ce]
    name=Gitlab CE Repository
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
    gpgcheck=0
    enabled=1
sudo yum makecache
sudo yum install gitlab-ce
sudo gitlab-ctl reconfigure  #Configure and start GitLab

2、官网安装

本来说国外镜像很慢,一开始尝试用清华镜像,结果发现特别慢,根本下载不下来,于是用的仍然是官网的(结果这个几分钟就下载好了)

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[root@linux-node2 ~]# yum install -y gitlab-ce

出现问题

订阅插件提示:This system is not registered with an entitlement server. You can use subscription-manager to

每次yum调用(不禁掉plugins的情况下),都会更新此文件。

因此,为了不冲突,可以如下操作:停止掉该插件的使用,在配置文件中把enable=0即可。

vim /etc/yum/pluginconf.d/subscription-manager.conf
[root@Oradb1 pluginconf.d]# vim /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0           #将它禁用掉

安装rpm包

rpm -ivh gitlab-ce-8.6.7-ce.0.el7.x86_64.rpm

修改配置文件gitlab.rb

vim /etc/gitlab/gitlab.rb

查找到external_url 这个属性,将其改为ip+地址

加载配置文件并启动

gitlab-ctl reconfigure
gitlab-ctl restart