Gitlab在Centos7上的安装

一 官网说明

  • 安装步骤:https://about.gitlab.com/install/#centos-7

  • 安装说明:本文只是用来给微服务当配置中心,只是较浅的记录一下安装步骤,后面会详细讲解及在docker上面的安装。

1.安装和配置必要的依赖项

在CentOS 7(和RedHat / Oracle / Scientific Linux 7)上,以下命令还将在系统防火墙中打开HTTP,HTTPS和SSH访问。

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

接下来,安装Postfix以发送通知电子邮件。如果要使用其他解决方案发送电子邮件,请跳过此步骤, 并在安装GitLab之后配置外部SMTP服务器

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

在安装Postfix的过程中,可能会出现一个配置屏幕。选择“ Internet网站”,然后按Enter。使用服务器的外部DNS作为“邮件名”,然后按Enter。如果出现其他屏幕,请继续按Enter接受默认设置。

2.添加GitLab软件包存储库并安装软件包

添加GitLab软件包存储库。

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

接下来,安装GitLab软件包。更改https://gitlab.example.com为您要访问GitLab实例的URL。安装将自动配置并在该URL上启动GitLab。

对于https://URL,GitLab将使用Let's Encrypt自动请求证书,这需要入站HTTP访问和有效的主机名。您也可以使用自己的证书或仅使用http://。

sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

二 开始安装

  • 需要从官网下载 gitlab-ce-12.4.0-ce.0.el7.x86_64.rpm(ce为社区版,和ee没有太大区别)

  • https://pan.baidu.com/s/17T6BhNoBKnp61EZ6FEj7kw

然后按照上面的步骤进行安装

sudo rpm -ivh gitlab-ce-12.4.0-ce.0.el7.x86_64.rpm
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
  • Gitlab服务操作

初始化配置 gitlab
gitlab-ctl reconfigure
启动 gitlab 服务
gitlab-ctl start
停止 gitlab 服务
gitlab-ctl stop
  • 测试

     

猜你喜欢

转载自www.cnblogs.com/dalianpai/p/11726162.html