GitLab服务器搭建

准备1:给服务器安装Linux系统,或者使用虚拟机安装,版本推荐centos 7(我当前使用的版本是centos 7)

这里不赘述安装过程,不会的可以点击教程链接:Linux 安装

准备2:配置好Linux的IP地址

这里也不赘述:Linux设置IP地址

开始安装

1. 安装依赖软件
yum -y install policycoreutils openssh-server openssh-clients postfix
2.设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && 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_protocols = ipv4
inet_interfaces = all

修改之后启动就可以了
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

我在此处选择了一个较新的版本11.3.3,以方便大家后续的升级

下载rpm包并安装:

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

安装依赖

yum install policycoreutils-python -y

rpm -i gitlab-ce-11.3.3-ce.0.el7.x86_64.rpm

4.修改gitlab配置文件指定服务器ip和自定义端口:
vim /etc/gitlab/gitlab.rb
修改成如下:
IP地址+端口号: external_url 'http://192.168.0.217:8010'

进入修改的方法:按下键盘“i”

退出编辑器的方法:Esc -> Shift+Q -> 输入wq-> 回车

5.重置并启动GitLab
执行:

gitlab-ctl reconfigure

gitlab-ctl restart
6.访问页面
打开浏览器,输入前面配置的地址,如果本机可以访问,但其他电脑访问不了,应该是防火墙拦截了端口,可以在防火墙添加端口:

/sbin/iptables -I INPUT -p tcp --dport 8010 -j ACCEPT
如果访问的时候报502错误,加上这句:chmod -R 755 /var/log/gitlab

7.修改root密码
第一次访问时,会自动跳转到修改密码的界面:


原文地址:https://www.cnblogs.com/xy51/p/11389980.html