欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 锐评 > Linux 安装gitlab

Linux 安装gitlab

2025/2/24 18:25:20 来源:https://blog.csdn.net/xljx_1/article/details/145284149  浏览:    关键词: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

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词