Git系列(6-收尾) ----Centos7 安装 Gitlab

本文详细介绍了在CentOS 7环境下部署GitLab的步骤,包括环境设置、邮件服务器安装、仓库配置及GitLab包安装过程,并提供了页面访问测试的方法。
1.环境设置
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

 2.安装邮件服务器

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

3.安装仓库

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

4.安装gitlab包

sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
或
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ce

5.页面访问测试

 

参考 :https://about.gitlab.com/install/#centos-7

### GitLab HTTP远程访问功能配置 在CentOS内网环境中为GitLab配置和安装`git-remote-http`以支持HTTP协议进行仓库克隆与推送涉及多个步骤。虽然Nginx存在一些局限性,比如仅能支持http、https和Email协议[^1],但这并不影响其作为反向代理服务于GitLab的HTTP/HTTPS请求。 #### 安装必要的依赖包 为了使GitLab能够通过HTTP协议提供服务,首先需要确保系统已经安装了必要的软件包: ```bash sudo yum install -y curl policycoreutils openssh-server ``` 接着启动并设置SSH服务开机自启: ```bash sudo systemctl enable sshd sudo systemctl start sshd ``` #### 配置防火墙规则 如果系统运行着firewalld,则需开放80 (HTTP) 和443 (HTTPS)端口: ```bash sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --reload ``` #### 安装GitLab CE版 对于CentOS来说,官方推荐的方式是从GitLab提供的yum源安装社区版本(CE): ```bash curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo EXTERNAL_URL="http://your_domain_or_IP" yum install -y gitlab-ce ``` 请注意替换命令中的`your_domain_or_IP`为你实际使用的域名或IP地址。 #### 启动GitLab服务 完成上述操作之后,可以初始化并启动GitLab: ```bash sudo gitlab-ctl reconfigure ``` 此过程可能耗时较长,请耐心等待直至结束。 #### 使用Nginx作为反向代理 由于GitLab自带了一个基于Puma的应用服务器,默认情况下会监听本地9080端口。为了让外部可以通过标准HTTP(S)端口访问到GitLab实例,建议使用Nginx作为前端反向代理。编辑位于/etc/gitlab/gitlab.rb文件,在其中加入如下配置项: ```ruby external_url 'http://your_domain_or_IP' nginx['enable'] = true nginx['redirect_http_to_https'] = false # 如果不需要强制重定向至HTTPS则设为false ``` 保存更改后再次执行reconfigure指令让新设定生效。 此时应该可以在浏览器里输入指定URL来验证GitLab页面是否正常加载,并且也具备了通过HTTP方式clone/push的能力。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值