Linux 安装gitlab

1. 更新系统

确保系统是最新的:

sudo yum update -y

2. 安装依赖项

安装必需的依赖项:

sudo yum install -y curl policycoreutils-python openssh-server

GitLab 需要一个邮件服务来发送通知。你可以使用现有的邮件服务器,或者在本地配置 Postfix:

sudo yum install -y postfix
sudo systemctl enable postfix
sudo systemctl start postfix

4. 添加 GitLab 官方仓库

下载并添加 GitLab 的官方安装脚本:

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

5. 安装 GitLab 社区版

运行以下命令安装 GitLab 社区版:

sudo yum install -y gitlab-ce

6. 配置 GitLab

安装完成后,编辑 GitLab 配置文件以设置你的域名或 IP 地址:

sudo vi /etc/gitlab/gitlab.rb

找到以下行并修改为你的实际域名或 IP 地址:

external_url 'http://your_domain_or_ip'

7. 启动 GitLab

运行以下命令应用配置并启动 GitLab:

sudo gitlab-ctl reconfigure

8. 开放防火墙端口

默认情况下,GitLab 使用 HTTP 的 80 端口和 SSH 的 22 端口。运行以下命令开放这些端口:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --reload

9. 访问 GitLab

在浏览器中访问 http://your_domain_or_ip,初次登录时会要求设置管理员密码。

10. 配置 SSH(可选)

如果需要使用 SSH 克隆项目,确保 sshd 服务正在运行:

sudo systemctl enable sshd
sudo systemctl start sshd
相关推荐
chian-ocean19 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=21 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸1 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
sz66cm2 小时前
Linux基础 -- ARM 32 位架构动态注入代码技术文档
linux·arm开发·架构
Mr.pyZhang4 小时前
Android构建系统 - 04 编译产物
android·linux