简介
gitlab是一个开源的Git仓库管理系统,旨在为企业和开发者提供一个安全可靠且易于使用的代码管理平台;它提供了版本管理、代码审查、问题跟踪等协作功能,并通过易用的Web界面进行操作。Gitlab具有完善的权限系统,允许管理者对不同的用户和团队设置不同的访问权限、修改权限、下载权限等.(来源于百度百科)
官方文档地址
gitlab官方文档:GitLab Documentation
gitlab中文官方文档:极狐GitLab 安装系统要求 | 极狐GitLab
服务器配置
至少4G以上内存,cpu最少为2核,不然安装的时候容易报内存溢出。
开始安装
第一步:安装yum源
yum install -y curl policycoreutils-python-utils openssh-server perl
可能会遇到问题
解决办法:重新配置阿里云源
- 打开官网:https://developer.aliyun.com/mirror/
- 选择你的系统
-
按照官网执行相关命令即可解决
第二步:开启ssh访问
systemctl enable sshd systemctl start sshd
第三步:配置防火墙,打开http和https访问
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https systemctl reload firewalld
第四步:安装 Postfix 以发送电子邮件通知(如果选择其他通知可不安装)
yum install postfix(可能会有包冲突 跳过就是) systemctl enable postfix systemctl start postfix
第五步:配置极狐GitLab 软件源镜像
curl -fsSL https://packages.gitlab.cn/repository/raw/scripts/setup.sh | /bin/bash
第六步:下载gitlab(一定要下载操作系统对应的镜像包)
镜像地址:https://packages.gitlab.com/gitlab/gitlab-ce
安装gitlab
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.2.3-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
可能会遇到问题
Unable to find a match: policycoreutils-python
解决方法
一般是操作系统和rpm包不对应,下载对应的包即可解决问题
第七步:安装完成 需要进行配置(ip访问不配置也可以 默认端口80)
vim /etc/gitlab/gitlab.rb
重新配置命令,不管是不是修改了配置文件,都要执行(这个过程可能比较长,耐心等待完成即可)
gitlab-ctl reconfigure
启动服务
gitlab-ctl start
查看服务状态
gitlab-ctl status
停止服务
gitlab-ctl stop
第八步:开放相应的端口即可访问
注意:root的初始密码在/etc/gitlab/initial_root_password下查看
至此我们就有属于自己的gitlab仓库了,动手搭建起来吧。