Centos7安装Gitlab

最近工作中需要搭建SpringCloud的自动化部署平台,所以我们需要Gitlab来存放代码。

1、安装依赖软件

$ yum -y install policycoreutils openssh-server openssh-clients postfix

2、设置postfix开机自启,并启动,postfix支持gitlab发信功能

$ systemctl enable postfix && systemctl start postfix

3、下载gitlab安装包,然后安装

这边选择最新版本的Gitlab安装就可以了。

Gitlab下载地址

我们可以将上面链接中的rpm安装包下载到本地,然后再转到虚拟机中,也可以通过命令下载

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

之后我们进行安装

$ rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

安装完成后我们需要更改端口号,找到Gitlab配置文件

$ vim /etc/gitlab/gitlab.rb

将Gitlab默认的8080端口改成其他端口(8080经常被占用),这里我改成8082端口,图示如下:   

     

保存后让配置文件生效,启动Gitlab

$ gitlab-ctl reconfigure
$ gitlab-ctl start

然后通过浏览器我们访问 http://192.168.3.202:8082/,效果图如下:

然后我们注册一个Gitlab账号,登录,效果图如下:

 Gitlab平台搭建完成。