# Linux环境 GitLab 安装

> 来源：梦飞idc云平台 | 原文：https://www.mfisp.com/11670.html | 发布：2022-10-26 | 更新：2022-10-26 | 分类：建站教程、投稿分享

**1.安装和配置必要的依赖项**  
在CentOS 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  
( 提示"FirewallD is not running",  
systemctl status firewalld;  
systemctl start firewalld;  
)

 

安装Postfix以发送通知电子邮件  
sudo yum install postfix  
sudo systemctl enable postfix  
sudo systemctl start postfix

 

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

 

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  
**常用命令**  
查看版本  
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION  
刷新配置  
gitlab-ctl reconfigure  
启动、关闭和重启（/opt/gitlab/bin）  
gitlab-ctl start  
gitlab-ctl stop  
gitlab-ctl restart  
提示“ok：run”成功。如下图：  
![Linux环境 GitLab 安装](https://www.mfisp.com/wp-content/uploads/2022/10/11670-ns7Xp6.png)

 

问题：  
运行 gitlab-ctl reconfigure 命令时出现下面的 letsencrypt 证书错误：  
![Linux环境 GitLab 安装](https://www.mfisp.com/wp-content/uploads/2022/10/11670-zipyYZ.png)  
答：  
在 /etc/gitlab/gitlab.rb 中添加 letsencrypt['enable'] = false 可解决。

 

gitlab http访问404错误  
答：  
检查Firewalls是否增加http服务是否安装，尝试关闭防火墙，/etc/gitlab/gitlab.rb 配置中注释external_url

 

![Linux环境 GitLab 安装](https://www.mfisp.com/wp-content/uploads/2022/01/13e1e49bb26b66e_1_post.png)

---
本页由 梦飞idc云平台（https://www.mfisp.com）提供。站点导航见 https://www.mfisp.com/llms.txt
