台式机CentOS7安装&GitLab11.10.4搭建(3)GitLab下载&安装

本文详细介绍了在CentOS7上部署GitLab的完整步骤,包括系统配置、安装GitLab软件包、端口设置及修改、GitLab配置文件调整等关键环节,确保GitLab服务稳定运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.按照官网流程走一遍:https://about.gitlab.com/install/#centos-7

在CentOS 7(和RedHat / Oracle / Scientific Linux 7)上,以下命令还将在系统防火墙中打开HTTP和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 systemctl reload firewalld

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

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

在Postfix安装期间,可能会出现配置屏幕。选择“Internet Site”并按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

 

 

 

2.添加端口&修改端口

添加8888和8887端口,并修改gitlab默认访问端口

添加端口

firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --zone=public --add-port=8887/tcp --permanent
firewall-cmd --reload

gitlab默认是80端口,如果存在端口冲突,需要修改端口,如果不存在端口冲突,则不需要。

3.修改/etc/gitlab/gitlab.rb

sudo vim /etc/gitlab/gitlab.rb 或者 vim /etc/gitlab/gitlab.rb

按i键,进入编辑模式,修改external_url后面的内容为:

external_url 'http://192.168.10.200:8888'

添加:

nginx['listen_port'] = 8888
unicorn['port'] = 8887

按Esc键,推出编辑模式

输入":wq"按回车,保存gitlab.rb的内容

4.重置并启动GitLab

gitlab-ctl reconfigure

gitlab-ctl restart

5.内网找一台电脑尝试访问,看到登录界面,则说明搭建成功:根据上面的配置,我的gitlab地址是 192.168.10.200:8888

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值