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
相关推荐
未济3 天前
linux 配置环境变量
linux
傲世仙尊3 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫3 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.3 天前
进程间通信
linux
AI职业加油站3 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-053 天前
Linux IO编程——静态库、动态库
linux
此冬歌咏3 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz3 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅3 天前
linux(8) 软硬链接
linux·运维·服务器
AIgorithmGEEK3 天前
[Linux]线程三部曲(上):一个执行流的诞生——从操作系统一路拆到 pthread_create
linux·线程·pid