前置准备:虚拟机安装以及配置相关
包含安装 centos7、8 虚拟机、设置静态 ip 等
https://www.cnblogs.com/poloyy/category/1703784.html
注意:我用的是 centos 7
官方安装教程
https://about.gitlab.com/install/
安装 Gitlab 前系统预配置准备工作
关闭 firewalld 防火墙
# 看防火墙状态 systemctl status firewalld # 暂停运行防火墙 systemctl stop firewalld # 看防火墙状态 systemctl status firewalld # 禁止防火墙自启 systemctl disable firewalld # 看防火墙状态 systemctl status firewalld
关闭 selinux 强制访问安全策略
保证该策略不会影响 gitlab 正常运行
# 第一步 关闭selinux vim /etc/sysconfig/selinux .... SELINUX = disabled .... # 第二步重启虚拟机 reboot
验证是否已关闭成功
[root@localhost ~]# getenforce
Disabled
安装 Omnibus Gitlab-ce package
Omnibus
- 综合性
- Gitlab 为了方便大家快速上手,推出这个包,一键下载安装 Gitlab 需要的依赖、组件、配置
- 如果用源代码的安装方式,会比较繁琐、
安装 Gitlab 组件
yum -y install curl policycoreutils openssh-server openssh-clients postfix perl
配置 Gitlab yum 仓库源
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sud
启动 postfix 邮件服务
systemctl start postfix && systemctl enable postfix
安装 Gitlab-ce 社区版本
记住是社区版本,所以是免费的
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
这里其实就可以通过浏览器访问你的 Gitlab 了,但还有一些操作要做
本地 hosts 文件,配置域名和虚拟机 IP
为什么要做这一步
因为我们是通过虚拟机需搭建社区版 Gitlab 的,上面安装 gitlab-ce 的时候也指定了相对 URL,为的就是更方便访问 Gitlab,有一个域名(就是下面这部分操作)
sudo EXTERNAL_URL="http://gitlab.example.com"yuminstall -y gitlab-ce