一个专业运
维技术分享!

Centos7部署Gitlab14.2.3(202109-亲测)

一、Gitlab是什么

GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。

可以认为GitLab是免费版的Github,主要功能都差不多。非付费用户在Github上只能创建开源项目,如创建私有项目则需付费,费用也比较昂贵。GitLab有社区版和企业版,社区版是免费,对绝大部分公司来说功能是足够用了 ,在企业内部搭建,可以创建私有项目,老板再也不用担心代码存在别人家的服务器上了。
二、安装准备

下载Github安装包

清华大学开源软件镜像站:

https://mirrors.tuna.tsinghua.edu.cn/
1、选择社区版

2、选择yum->el7

注:el是Red Hat Enterprise Linux(EL)的缩写

EL6是Red Hat 6.x,CentOS 6.x和CloudLinux 6.x的下载

EL5是Red Hat 5.x,CentOS 5.x和CloudLinux 5.x的下载

EL7是Red Hat 7.x,CentOS 7.x和CloudLinux 7.x的下载

博主用的是CentOS 7.9,大家自行选用即可。

3、下载镜像

镜像地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.2.3-ce.0.el7.x86_64.rpm

安装wget:

yum -y install wget

下载镜像:

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.2.3-ce.0.el7.x86_64.rpm

有点大,等两分钟。。。
三、安装和配置必要的依赖项

1、安装防火墙

yum install firewalld systemd -y
2、开启防火墙

service firewalld start
3、安装SSH协议

yum install -y curl policycoreutils-python openssh-server
4、设置SSH服务开机自启动

systemctl enable sshd
5、启动SSH服务

systemctl start sshd
6、添加HTTP服务到firewalld

firewall-cmd --permanent --add-service=http
7、添加HTTPS服务到firewalld

firewall-cmd --permanent --add-service=https
8、重启防火墙

systemctl reload firewalld
9、安装Postfix以发送通知邮件

yum install postfix
10、将postfix服务设置成开机自启动

systemctl enable postfix
11、启动postfix

systemctl start postfix
12、安装vim编辑器

yum install vim -y

好了,准备完毕,开始安装吧。。。开干
四、安装GitLab

1、安装rpm包

rpm -ivh gitlab-ce-14.2.3-ce.0.el7.x86_64.rpm

2、修改配置文件

#编辑配置文件
vim /etc/gitlab/gitlab.rb
#修改访问URL
#格式:external_url 'http://ip:端口'
external_url 'http://192.168.1.1:8080'
#配置时区
gitlab_rails['time_zone'] = 'Asia/Shanghai'

url也可在安装是进行配置,参考官方文档

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

3、防火墙开放端口

# 开放8080端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
4、重启防火墙

firewall-cmd --reload
5、查看端口号是否开启

firewall-cmd --query-port=8080/tcp
6、重置Gitlab

gitlab-ctl reconfigure
7、启动Gitlab

gitlab-ctl restart

8、访问Gitlab页面

注:首次访问时,会自动进入管理员密码设置页面,管理员默认账户为root。
五、设置中文

登录后可进行语言设置:

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

PS: GitLab 后台修改用户密码

# 打开控制台
gitlab-rails console -e production

# 找到用户,输入密码,确认密码,保存
user = User.find_by(username: 'root')
user.password = '12345678'
user.password_confirmation = '12345678'
user.save!


微信扫描下方的二维码阅读本文

赞(5) 打赏
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。小柳实验室 » Centos7部署Gitlab14.2.3(202109-亲测)

相关推荐

  • 暂无文章

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏