centos7安装gitLab

12 篇文章 0 订阅
本文详细介绍了在CentOS7上安装GitLab的步骤,包括下载镜像、安装依赖、配置SSH、Postfix及防火墙,修改GitLab配置文件,解决502错误,并设置中文界面。此外,还提供了常用GitLab管理命令和问题排查方法。
摘要由CSDN通过智能技术生成

安装gitLab

CSDN参考

1.下载镜像

# 安装wget
yum -y install wget

# 下载镜像(需要等待几分钟)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

2.安装和配置必要的依赖项

不是必须项,因为我是服务器上没有这些

# 安装防火墙
yum install firewalld systemd -y

# 开启防火墙
service firewalld  start

# 安装SSH协议
yum install -y curl policycoreutils-python openssh-server

# 设置SSH服务开机自启动
systemctl enable sshd

# 启动SSH服务
systemctl start sshd

# 添加HTTP服务到firewalld
firewall-cmd --permanent --add-service=http

# 添加HTTPS服务到firewalld
firewall-cmd --permanent --add-service=https

# 重启防火墙
systemctl reload firewalld

# 安装Postfix以发送通知邮件
yum install postfix

# 将postfix服务设置成开机自启动
systemctl enable postfix

# 启动postfix
systemctl start postfix

# 安装vim编辑器
yum install vim -y

3.安装GitLab

# 安装rpm包(时间稍微长点)
rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

image-20210129190241820

4.修改配置文件

# 编辑配置文件
vim  /etc/gitlab/gitlab.rb

#修改访问URL
#格式:external_url 'http://ip:端口'
external_url 'http://192.168.0.103:80'

#配置时区
gitlab_rails['time_zone'] = 'Asia/Shanghai'

5.防火墙开放端口

# 开放8080端口
firewall-cmd --zone=public --add-port=80/tcp --permanent 
# 重启防火墙
firewall-cmd --reload
# 查看端口号是否开启
firewall-cmd --query-port=80/tcp

6.重置Gitlab

# 时间长点
gitlab-ctl reconfigure

7.启动Gitlab

gitlab-ctl restart

# 进入页面先设置密码
# 登录时默认用户名为  root  密码为你刚设置的

image-20210129205033416

8.502页面

# 在执行完第7步,访问192.168.0.103:80
# 页面显示502
# 在次返回到第4步重新配置
external_url 'http://192.168.0.103:10085'
# 我访问 192.168.0.103:80 时页面正常显示
# 当 reboot 重启之后,启动后访问 192.168.0.103:10085 正常访问,80则无法访问
# 有没有小伙伴知道这个问题

9.设置中文

Settings -> Preferences -> Localization -> Language -> 简体中文

image-20210129210658221

8.常用命令

# 停止命令
gitlab-ctl stop
# 重启
gitlab-ctl restart

学习来源主要还是来自网络

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值