写在前面:
安装gitlab需要硬件支持,本次安装是使用阿里云ECS服务器,第一次尝试配置为1VCPU 2G,可以安装,但是运行或者执行gitlab-ctl reconfigure命令时会出现严重卡顿或者出现内存不足或者其他的一些问题,使用2vCPU 4GB配置,安装过程比较流畅,且顺利完成安装并启动
安装流程
安装一些必须的配置
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
安装邮件服务
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
遇到的小坑
启动邮件服务可能会遇到下面的问题:
- 查看报错原因
启动postfix出错,查看centos中的postfix日志
more /var/log/maillog //查看日志
postfix: fatal: parameter inet_interfaces: no local interface found for ::1 //错误信息
- 原因
配置文件中inet_interfaces设置为localhost,查阅了一些博文,发现由于这个配置的存在,导致postfix只支持接受本地的内部邮件,其他邮件不接收 - 解决措施
修改/etc/postfix/main.cf
将
inet_interfaces = localhost
inet_protocols = all
改成:
inet_interfaces = all
inet_protocols = all
下载GitLab资源包
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
也可以进入清华大学开源镜像站下载安装,速度会比较快
https://mirrors.tuna.tsinghua.edu.cn
配置个人gitlab域名并解析
vim /etc/gitlab/gitlab.rb
修改external_url="http://gitlab.example.com"
重新配置并重启gitlab服务
gitlab-ctl reconfigure
gitlab-ctl restart
注:
- GitLab服务默认监听80端口,如果需要自定义域名访问,需要在需要访问gitLab服务的机器上配置域名解析(修改Host文件,比如配置的external_url为"http://gitlab.example.com",那就需要配置一条记录: 目标IP http://gitlab.example.com )
- 需要按照实际情况自行修改端口
至此GitLab安装完成
可以通过ip访问到gitlab
by Relon
如有问题请指教