GitLab简介
GitLab,是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目安装。
它拥有与GitHub类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。
团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。
1.安装ssh
sudo yum install -y curl policycoreutils-pythonopenssh-server
2.将SSH服务设置成开机自启动,安装命令:
sudo systemctl enable sshd
3.启动SSH服务,安装命令:
sudo systemctl start sshd
4。安装防火墙(如果已经安装了防火墙并且已经在运行状态,则可直接进行第6步)
yum install firewalld systemd -y
5.开启防火墙,安装命令:
service firewalld start
6.添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。
sudo firewall-cmd --permanent --add-service=http
7.重启防火墙,安装命令:
sudo systemctl reload firewalld
8.安装wget 用于从外网上下载插件
安装命令:
yum -y install wget
9.安装vim编辑器 安装命令:
yum install vim -y
二、添加GitLab镜像源并安装gitlab服务器
1.添加gitlab镜像
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
下载过程中可能会出现一下错误
更新一下CA证书就可以了
sudo yum update ca-certificates sudo yum reinstall ca-certificates
2.安装gitlab 安装命令:
rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
注意:Centos8和7对应的gitlab版本也是有区分的,如果7安装了8的版本就会报错如下:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-12.10.0-ce.0.el8.x86_64.rpm el8代表centos8版本的gitlab 同理https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.10.0-ce.0.el7.x86_64.rpm el7代表的是centos7版本的gitlab
也可以使用 rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm --nodeps --force 安装时不在解析包直接的依赖关系直接安装
如果提示rpm失败需要执行一下命令
yum install policycoreutils-python
4.修改gitlab配置文件指定服务器ip和自定义端口:
vim /etc/gitlab/gitlab.rb
进入编辑器后按“i”键进入编辑状态,ESC键退出编辑状态:wq
5.重置并启动GitLab
执行:
gitlab-ctl reconfigure
gitlab-ctl restart
# 开放8080端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload



