有勇气的牛排博客

gitlab简单搭建教程

有勇气的牛排 1127 开源 2023-10-24 20:50:02

前言

GitLab 是一个基于 Web 的 Git 仓库管理工具,提供代码托管、版本控制、CI/CD 集成和团队协作功能。本地 GitLab 指在自己的服务器或本地计算机上搭建并运行 GitLab 实例,而非使用 GitLab 提供的云服务(如 gitlab.com)。

安装gitlab

关闭防火墙

安装依赖

yum -y install curl policycoreutils-python openssh-server perl

配置邮件服务器

yum -y install postfix systemctl enable postfix systemctl start postfix

yum源

官方

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash 

国内镜像

vim /etc/yum.repos.d/gitlab-ce.repo
//添加如下内容 
[gitlab-ce] 
name=Gitlab CE Repository 
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ 
gpgcheck=0 
enabled=1 

更行yum缓存

yum makecache fast

安装

yum -y install gitlab-ce 
# 指定版本安装
yum -y install gitlab-ce-x.x.x 

rpm安装

cd /data/tools 
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.0.3-ce.0.el7.x86_64.rpm 
rpm -ivh gitlab-ce-14.0.3-ce.0.el7.x86_64.rpm

配置url

vim /etc/gitlab/gitlab.rb
external_ur=http://192.168.56.21:8085

加载配置

gitlab-ctl reconfigure

①初始化默认管理员帐户的用户名为 root ,密码存储在

/etc/gitlab/initial_root_password 文件中,此文件将在 24 小时后的第一次重新配置运行中清除。

cat /etc/gitlab/initial_root_password

②若非必要不建议做第二次初始化,后续若有修改配置文件使用命令 gitlab-ctl restart 重启所有组件服务即可生效新的配置。

③先修改gitlab.rb文件中的“external_url”选项值,再使用“gitlab-ctl reconfigure”命令配置GitLab。就不需要在配置后修改 “


留言

专栏
文章
加入群聊