感谢大神分享:
https://blog.csdn.net/icelili/article/details/107205828
在centos7中验证。
一、安装gitlab前准备工作
1、安装防火墙(一般已经有了),并启动
yum install firewalld systemd -y
systemctl start firewalld
2、安装SSH协议、设置开机自启、启动
yum install -y curl policycoreutils-python openssh-server
systemctl enable sshd
systemctl start sshd
3、在firewalld中添加HTTP和HTTPS、并reload firewall
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
4、安装postfix
yum install postfix
在postfix的启动过程中会出现一些问题,可借助命令:“postfix check”,若有输出,则需解决对应的问题。在此针对本人安装过程中出现的问题进行记录:
(1)第一个问题,就是要修改配置文件:(按需修改)
vi /etc/postfix/main.cf
本人修改的配置为:(仅作服务安装练手用)
inet_interfaces = all
inet_protocols = ipv4
第二和第三个问题的表现如下:
(2)原因:centos7安装的为mysql8,是没有libmysqlclient.so.18文件,取而代之的是libmysqlclient.so.20
解决:下载mysql-community-libs-compat-5.7.29-1.el7.x86_64.rpm安装即可
下载地址:https://dev.mysql.com/downloads/mysql/
(3)修改/usr/sbin目录下postdrop、postqueue的权限
chmod g+s /usr/sbin/postqueue
chmod g+s /usr/sbin/postdrop
postfix reload
5、设置postfix自启、并启动
systemctl enable postfix
systemctl start postfix
二、安装gitlab
1、下载rpm包、并安装
下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
2、修改配置文件,ip和port根据具体情况设置
#编辑配置文件
vi /etc/gitlab/gitlab.rb
#修改访问URL
#格式:external_url 'http://ip:端口'
external_url 'http://ip:port'
#配置时区
gitlab_rails['time_zone'] = 'Asia/Shanghai'
3、防火墙开放对应端口
firewall-cmd --zone=public --add-port=端口/tcp --permanent
firewall-cmd --reload
4、重置gitlab并启动。(重置和启动的时间较长,本人1核2G服务器,基本垮掉)
gitlab-ctl reconfigure
gitlab-ctl restart