Gitlab安装
1.安装相关依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
2.启动ssh服务并设置为开机启动
sudo systemctl enable sshd && systemctl start sshd
3.设置postfix开机自启, 并启动, postfix支持gitlab发信功能
sudo systemctl enable postfix && systemctl start postfix
4.开放ssh以及http服务, 然后重新加载防火墙列表
firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
注:若已关闭防火墙, 就不需要做以上配置
5.下载gitlab包, 并且安装
5.1.在线下载安装包:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm
安装:
rpm -i gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm
6.修改gitlab配置
使用如下命令可以找到gitlab的安装位置:
sudo find / -name gitlab
根据实际情况查找下面的 gitlab.rb路径, 有的情况是gitlab.rb.template
vim /etc/gitlab/gitlab.rb
修改gitlab访问地址和端口, 默认为80, 我们改为82
external_url 'http://192.168.220.128:82'
nginx['listen_port']=82
7.重载配置及启动gitlab
注:若失败, 尝试在命令前加 sudo
gitlab-ctl reconfigure
gitlab-ctl restart
8.把端口添加到防火墙
firewall-cmd --zone=public --add-port=82/tcp --permanent
firewall-cmd --reload
启动成功后, 看到以下修改管理员的root密码的页面, 修改密码后, 然后登录即可.
若执行以上内容后依然失败, 可执行如下步骤:
先执行如下内容:
rpm -e gitlab-ce-12.4.2-ce.0.el6.x86_64
再通过清华大学开源软件镜像网站下载你想要的的gitlab版本上传到虚拟机中:
清华大学开源软件镜像网站:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
再执行5.1之后的所有步骤.