linux下安装gitlab

分类: Linux

最近工作刚好用到这个,所以写下笔记记录下,网上找了下也有不少教程,但都各有不同,这里直接按照官网的说明来安装,https://about.gitlab.com/installation/
在该地址,可以看到不同的系统,由于我的服务器是centos 7的,所以这里就选择centos 7.
官网的指示,默认安装的是ee版本,而且速度慢,这边分别介绍两种方式安装,一种是根据官网的来,另一种是使用国内的镜像

通过清华大学镜像安装

到这里 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce 去找到合适你的系统和安装方式,我的是centos7.所以通过以下链接https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/,找到最新版的镜像等下用

1.先安装ssh依赖

sudo yum install -y curl policycoreutils-pythonopenssh-server

2.设置ssh开机自启

sudo systemctl enable sshd 

3.启动ssh服务

sudo systemctl start sshd

4. 防火墙

由于我这边是在虚拟机上操作的,防火墙那些全部关闭了,所以这步跳过

5.下载上面找到的清华的镜像

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

6.执行安装

rpm -i gitlab-ce-12.10.1-ce.0.el7.x86_64.rpm

如果安装时提示无效依赖 使用

rpm -i gitlab-ce-12.10.1-ce.0.el7.x86_64.rpm --nodeps --force

命令就可以了

7.修改访问路径

vim  /etc/gitlab/gitlab.rb

然后应用配置并重启
gitlab-ctl reconfigure
gitlab-ctl restart

通过官网方式安装

1.按照提示,先安装依赖

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

由于我的服务器关闭了防火墙,防火墙的操作可以看我另一篇文章【CentOS7 使用 firewalld 打开关闭防火墙与端口】,这边就没有执行有关防火墙的命令了。

2.按照提示继续往下执行安装profix

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

3.安装仓库和包

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

我这里安装的时候有些镜像不行,所以等了好一会儿,如下图

图片1.png

4.最后是安装gitlab包

我这边把ip通过host映射到下面的域名了,等待安装完成.

sudo EXTERNAL_URL="http://gitlab.gulu.com" yum install -y gitlab-ee

安装完成如下图所示

图片2.png

5.启动

配置:gitlab-ctl reconfigure
启动:gitlab-ctl start

访问上面配置的地址:http://gitlab.gulu.com

图片3.png

邮件配置

安装Postfix以发送通知邮件

sudo yum install postfix

设置成开机自启

sudo systemctl enable postfix

修改邮件的相关信息

vim  /etc/gitlab/gitlab.rb

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注


Warning: error_log(/www/wwwroot/codegulu.cn/wp-content/plugins/spider-analyser/#log/log-1011.txt): Failed to open stream: Permission denied in /www/wwwroot/codegulu.cn/wp-content/plugins/spider-analyser/spider.class.php on line 2969