【学习GitLab】初次安装

1. 前言

最近在学习 GitLab,将学习成果做个简要总结,以供大家参考。如有错误,欢迎留言纠正!你的「点赞」或「打赏」将是对我最大的支持和鼓励!

本次系列文章包括:

2. 安装

官网指南:https://about.gitlab.com/install/

2.1 GitLab-CE和GitLab-EE的区别

GitLab有免费的社区版 GitLab-CE 和收费的企业版 GitLab-EE,有关这两个版本的更多信息可看官方 Community Edition or Enterprise Edition 介绍。

本文以 GitLab-CE 为例,介绍安装方法。

2.2 环境要求

对安装环境的要求,官方特别要求 4GB 内存,其他更多要求可参阅 Requirements 说明。

2.3 安装方式

官方介绍的安装方法有两种:

  • Installation from source
  • Omnibus GitLab installs

什么是 Omnibus 官网有解释:

Official Linux package (recommended installation)
Install via a single package (also known as Omnibus) that bundles all the different services and tools required to run GitLab

即 Omnibus 相当于一键安装包,自动安装gitlab所依赖的所有组件。本文将选择这种方式进行安装。

另外,特别说明 Bitnami GitLab CE 其实就是上面所说的 Omnibus GitLab。下文是 Bitnami 的声明:

The Bitnami GitLab CE stack uses the standard GitLab Omnibus package, enabling easy updates- simply access the machine via secure shell, run a simple update command, and the application updates itself!

2.4 安装

官网默认介绍的安装说明是针对 GitLab-EE 的,GitLab-CE 的官方安装方法见 Install GitLab Community Edition.

在我 Ubuntu 18.04 64bit 环境中,安装步骤为:

sudo apt-get install -y curl openssh-server ca-certificates tzdata
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://192.168.1.99" apt-get install gitlab-ce

其中 192.168.1.99 是我电脑的 IP 地址。

如果从 gitlab 官网下载安装包的速度比较慢,也可以考虑使用国内的清华大学源,安装说明详见「Gitlab Community Edition 镜像使用帮助」,不过清华大学源相对于官方在版本上会有些滞后。

安装后,默认管理员用户名为 root,第一次登录强制要求设置密码。

2.5 命令

常用命令:

gitlab-ctl start                # 启动服务
gitlab-ctl stop                 # 停止服务
gitlab-ctl restart              # 重启服务
gitlab-ctl status               # 查看状态
gitlab-ctl tail                 # 查看日志

配置相关命令:

gitlab-ctl show-config          # 查看当前配置
vi /etc/gitlab/gitlab.rb        # 修改配置
gitlab-ctl reconfigure          # 启动配置

开启开机自启动:

systemctl enable gitlab-runsvdir.service
systemctl start gitlab-runsvdir.service

关闭开机自启动:

systemctl disable gitlab-runsvdir.service

查看开机自启动服务:

systemctl list-jobs

2.6 卸载

sudo apt-get remove gitlab-ce

安装时会涉及以下目录,卸载后记得检查下,还有没有残留文件,如果安装过程中遇到错误,可以试着删除这些文件:

/opt/gitlab/
/var/opt/gitlab/
/etc/gitlab/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值