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
相关推荐
Johny_Zhao12 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
碳基沙盒2 天前
OpenClaw 多 Agent 配置实战指南
运维
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash3 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行4 天前
Linux和window共享文件夹
linux
木心月转码ing4 天前
WSL+Cpp开发环境配置
linux