文章目录
一、安装和配置必要的依赖项
1、安装必要服务,打开防护墙的 ssh、http、https 的端口
[root@localhost ~]# yum install -y curl policycoreutils-python openssh-server
[root@localhost ~]# systemctl enable sshd
[root@localhost ~]# systemctl start sshd
[root@localhost ~]# firewall-cmd --permanent --add-service=http
[root@localhost ~]# firewall-cmd --permanent --add-service=https
[root@localhost ~]# systemctl reload firewalld
2、安装邮件服务,如果使用其它邮件服务器可跳过此步骤
[root@localhost ~]# yum install postfix
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# systemctl start postfix
二、添加 gitlab 存储库并安装
1、添加 gitlab 存储库
[root@localhost ~]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
2、安装 gitlab
[root@localhost ~]# yum install -y gitlab-ee
三、访问 gitlab 并重置密码
直接在浏览器输入域名或IP地址,gitlab的web访问端口默认是80
重置密码后使用root账户登录
访问时如果报502错误
1、查看是否端口被占用,最常见的是8080端口被占用。
修改此文件:/etc/gitlab/gitlab.rb
添加一行:unicorn[‘port’]=8101
执行 gitlab-ctl reconfigure 重新配置 gitlab
[root@localhost ~]# gitlab-ctl reconfigure
执行 gitlab-ctl restart 重启 gitlab
[root@localhost ~]# gitlab-ctl restart
2、查看是否为系统配置不够,例如内存要求至少为4G
如果自己练手搭建可以通过修改交换分区的大小来解决此问题
# 修改swap大小 [root@localhost ~]# dd if=/dev/zero of=/usr/swap bs=512 count=8388616 [root@localhost ~]# mkswap /usr/swap [root@localhost ~]# sysctl -w vm.swappiness=60 [root@localhost ~]# swapon /usr/swap [root@localhost ~]# echo “/usr/swap swap swap defaults 0 0” >> /etc/fstab
然后重启 gitlab