开心一刻
睡着正香, 媳妇用力把我晃醒说:"快起来, 我爸来了."
我一下醒了, 手脚熟练的把衣服一抱, 滚到床底, 顺便把鞋也收了进去
媳妇蹲下无奈的说:"快出来! 咱俩都结婚半年了."
我:"对哦, 搞习惯了"
环境准备
Linux:CentOS 7
GitLab 社区版: GitLab-ce-12.8.7-ce.0.el6.x86_64.rpm, 可从 清华大学开源软件镜像站 下载
因为 GitLab 对内存要求比较高, 官方推荐至少准备 4G 内存来安装 GitLab, 我们就大方一点, 准备 5G
环境准备如下
楼主是新搭建的 CentOS 7, 环境非常干净, 便于 GitLab 的搭建 (主要是避免端口冲突, GitLab 包含很多组件, 它们都需要端口)
由于我们大天朝的那面墙的神奇作用, 按 GitLab 官方的安装教程 https://about.gitlab.com/install/ , 我们没法安装它, 但办法总比困难多, 具体我们往下看
GitLab 搭建
安装和配置必要的依赖项
1, 安装依赖项
[root@localhost opt]# yum install -y curl policycoreutils-python openssh-server
2, 启用 sshd
- [root@localhost opt]# systemctl enable sshd
- [root@localhost opt]# systemctl start sshd
3, 防火墙放行 http 和 https
- [root@localhost opt]# firewall-cmd --permanent --add-service=http
- [root@localhost opt]# firewall-cmd --permanent --add-service=https
- [root@localhost opt]# systemctl reload firewalld
楼主为了省事, 直接关了防火墙 (上面的做法是比较正经的!)
- [root@localhost opt]# firewall-cmd --state
- [root@localhost opt]# systemctl stop firewalld.service
- [root@localhost opt]# systemctl disable firewalld.service
安装 GitLab
安装非常简单, 就一行命令
[root@localhost opt]# rpm -ivh GitLab-ce-12.8.7-ce.0.el6.x86_64.rpm --force
安装应该非常快, 分分钟的事, 当出现下图, 就表示安装完成
配置 GitLab
GitLab 的配置文件路径: /etc/GitLab/GitLab.rb, 此时时只改一个配置项: external_url , 便于我们快速看到搭建效果
编辑 GitLab.rb: [root@localhost GitLab]# vi /etc/GitLab/GitLab.rb
楼主为了省事, 就不配置域名, 而直接配置成 ip 了
修改之后执行: [root@localhost opt]# GitLab-ctl reconfigure , 使得配置生效
首次配置比较慢, 因为需要配置, 初始化各个组件; 当出现下图内容时, 表示配置完成
配置完成后会生成各个组件的配置文件和日志文件, 配置文件路径: /opt/GitLab/etc/ , 日志文件路径: /var/log/GitLab/
一旦配置好, GitLab 也就启动了, 我们访问下: http://192.168.0.115/ , 当出现如下界面, 表示我们搭建成功了
初次访问会提示我们重置 root 账户的密码; 登录进去后, 主界面如下
至此, GitLab 基本搭建好了
关于常用的一些自定义配置, 以及搭建过程中遇到的问题, 我们另开一篇来讲, 内容挺多的
GitLab 常用命令
启动: GitLab-ctl start
查看状态: GitLab-ctl status
重启: GitLab-ctl restart
重新配置: GitLab-ctl reconfigure # 一般是修改配置后用
查看实时日志: GitLab-ctl tail
总结
1,GitLab 架构图
组件非常多, 更多详情请查阅: GitLab 实战三 --GitLab 架构组件详解 https://chegva.com/3229.html
2, 只要环境足够干净, 内存足够大, 搭建起来应该是没什么问题的
参考
GitLab Installation https://about.gitlab.com/install/
GitLab 实战三 --GitLab 架构组件详解 https://chegva.com/3229.html
来源: https://www.cnblogs.com/youzhibing/p/12487043.html