centos7安装部署gitlab服务器

1. 安装依赖软件

yum -y install policycoreutils openssh-server openssh-clients postfix

2.设置postfix开机自启,并启动,postfix支持gitlab发信功能

systemctl enable postfix && systemctl start postfix

  1. [root@ ~]# systemctl start postfix  
  2. Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details. 

修改 /etc/postfix/main.cf的设置  

  1. inet_protocols = ipv4  
  2. inet_interfaces = all 

设置gitlab发信功能,需要注意一点:

发信系统用的默认的postfix,smtp是默认开启的,两个都启用了,两个都不会工作。

我这里设置关闭smtp,开启postfix

关闭smtp方法:vim /etc/gitlab/gitlab.rb

找到#gitlab_rails['smtp_enable'] = true 改为 gitlab_rails['smtp_enable'] = false

修改后执行gitlab-ctl reconfigure

另一种是关闭postfix,设置开启smtp,相关教程请参考官网https://doc.gitlab.cc/omnibus/settings/smtp.html

测试是否可以邮件通知:

登录并添加一个用户,我这里使用qq邮箱添加一个用户

3.下载gitlab安装包,然后安装

centos 6系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6

centos 7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm

rpm -i soft/gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm 

如有以下报错:

warning: soft/gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
        policycoreutils-python is needed by gitlab-ce-10.7.3-ce.0.el7.x86_64

运行下面安装

yum install policycoreutils-python

rpm -i soft/gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm 

4.修改gitlab配置文件指定服务器ip和自定义端口:

vim  /etc/gitlab/gitlab.rb  (exernal 'http://localhost')

注意这里设置的端口不能被占用,默认是8080端口,如果8080已经使用,请自定义其它端口,并在防火墙设置开放相对应得端口

5.重置并启动GitLab

执行:

gitlab-ctl reconfigure  

gitlab-ctl restart

6、修改vi gitlab.yml

 gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: 192.168.1.2(改成域名)
    port: 9901(端口去掉)
    https: false

gitlab-ctl restart

原文地址:https://www.cnblogs.com/chenjiye/p/13765177.html