安装gitLab
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
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 密码为你刚设置的
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 -> 简体中文
8.常用命令
# 停止命令
gitlab-ctl stop
# 重启
gitlab-ctl restart
学习来源主要还是来自网络