Linux(Centos7.6)下安装Gitlab详细教程

Gitlab搭建操作步骤:

1、查看Linux系统版本确认gitlab需要使用的安装包类型

使用命令:cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
本系统是CentOS 7,对应官方教程地址:https://about.gitlab.com/install/#centos-7

We strongly recommend downloading the Omnibus package installation since it is quicker to install, easier to upgrade, and it contains features to enhance reliability not found in other methods.
We also strongly recommend at least 4GB of free RAM to run GitLab.

官方推荐2核8g的配置:

2、安装 curl,policycoreutils-python,openssh-server服务

使用命令:yum install -y curl policycoreutils-python openssh-server
出现以下界面,说明成功

3、将SSH服务设置成开机自启动

命令:systemctl enable sshd 

  

4、启动SSH服务

命令:systemctl start sshd

5、开启防火墙

命令:systemctl start firewalld或者service firewalld  start

6、添加http服务到firewalld,允许http服务通过, pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https

7、重启防火墙  

命令:(sudo) systemctl reload firewalld

  

8、接下来,安装Postfix以发送通知邮件,并将postfix服务设置成开机自启动

Linux centos 查看postfix已经安装 rpm -qa |grep postfix,如果安装过,则无需安装。
安装postfix:
命令:sudo yum install postfix
设置postfix自启动 命令:sudo systemctl enable postfix

9、启动Postfix

命令:ssudo systemctl start postfix
可能会启动失败:Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.
这是因为防火墙或者配置文件导致,无法启动的邮件服务,首先关闭防火墙,修改配置文件vim /etc/postfix/main.cf 
把inet_interfaces = localhost注释掉,把inet_interfaces = all的注释打开,然后就可以启动了。

可以通过命令:systemctl status postfix查看是否启动成功,下图所示标识启动成功

  

10、下载镜像

官网链接:https://packages.gitlab.com/gitlab/gitlab-ee/packages/el/7/gitlab-ee-12.5.4-ee.0.el7.x86_64.rpm

使用命令下载镜像:curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

出现下图所示,标识reposity镜像下载成功
安装镜像:sudo yum install -y gitlab-ee-12.5.4-ee.0.el7.x86_64,出现下图所示,标识安装成功

  

11、修改gitlab配置文件指定服务器ip和自定义端口

vim /etc/gitlab/gitlab.rb
使extenal_url指向自己的ip:extenal_url=”http://ip:8888”

  

12、刷新配置GitLab

命令:gitlab-ctl reconfigure,这个过程有点慢,请耐心等待哈

  

13、重置并启动GitLab

命令:gitlab-ctl start
启动成功如下图所示:

 

14、Gitlab常用命令:

sudo gitlab-ctl start # 启动所有 gitlab 组件;
sudo gitlab-ctl stop # 停止所有 gitlab 组件;
sudo gitlab-ctl restart # 重启所有 gitlab 组件;
sudo gitlab-ctl status # 查看服务状态;
sudo gitlab-ctl reconfigure # 启动服务;
sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
sudo gitlab-ctl tail # 查看日志;

  

参考链接:https://www.jianshu.com/p/d03a08dd28a2官方教程地址:https://about.gitlab.com/install/#centos-7

写博客是为了记住自己容易忘记的东西,另外也是对自己工作的总结,文章可以转载,无需版权。希望尽自己的努力,做到更好,大家一起努力进步! 如果有什么问题,欢迎大家一起探讨,代码如有问题,欢迎各位大神指正!  

猜你喜欢

转载自www.cnblogs.com/summary-2017/p/12038997.html