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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值