文章目录

  • 1.查看linux版本信息
  • 2.查看查看安装GitLab要求
  • 2.1安装和配置必要的依赖项
  • 2.2下载和安装GitLab
  • 3.访问GitLab
  • 3.1开放端口
  • 3.2访问https://IP:8600/


1.查看linux版本信息

查看Linux系统的版本信息:

cat /proc/version

查看Linux系统发行版信息:

cat /etc/redhat-release

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置

2.查看查看安装GitLab要求

查看GitLab安装的要求:https://about.gitlab.com/install/

如何查看gitlab配置文件以及位置 如何查看gitlab版本_IP_02

2.1安装和配置必要的依赖项

在CentOS 7(和RedHat/Oracle/Scientific Linux 7)上,下面的命令也会在系统防火墙中打开HTTP、HTTPS和SSH访问。

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 firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

如下图所示,出现FirewallD is not running,即防火墙未开启。

如何查看gitlab配置文件以及位置 如何查看gitlab版本_git_03


我们可以执行下述命令,查看防火墙状态

systemctl status firewalld

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置_04


执行下述命令开启防火墙

systemctl start firewalld

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置_05


重新执行下述命令

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

如何查看gitlab配置文件以及位置 如何查看gitlab版本_IP_06

2.2下载和安装GitLab

执行如下指令,获取安装脚本,自行安装所有依赖包。

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

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置_07


接着,执行如下指令,开始安装,EXTERNAL_URL为安装后进入该GitLab的页面地址,最好设置成你的“服务器ip/gitlab”,如果此时不设置,后面需要修改其配置文件的相关ip地址。

sudo EXTERNAL_URL=“https://gitlab.example.com” yum install -y gitlab-ee
注意切换成你的IP地址端口等信息。这里我是用的端口是8600,或者可用的域名,这里由于在线安装,网络不好可能会慢,楼主大概用了一个半小时。

sudo EXTERNAL_URL="https://你的服务IP:端口" yum install -y gitlab-ee

出现如下,在安装完成。

如何查看gitlab配置文件以及位置 如何查看gitlab版本_git_08

3.访问GitLab

3.1开放端口

安装完毕后,在浏览器页面访问:https://:8600

此时可能因为端口没有开放,而无法访问!

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置_09


linux系统开放8600端口

cd /etc/sysconfig
ls -l

在sysconfig下没有找到,本文中的linux为CentOS 7.7 ,CentOS 7默认没有了iptables文件。

如何查看gitlab配置文件以及位置 如何查看gitlab版本_IP_10


安装iptables-services

yum install iptables-services

启动iptables

systemctl enable iptables

如何查看gitlab配置文件以及位置 如何查看gitlab版本_版本信息_11

systemctl start iptables

在iptables中配置开放8600端口

vim /etc/sysconfig/iptables

insert进入编辑,

如何查看gitlab配置文件以及位置 如何查看gitlab版本_IP_12

编辑完按Esc退出编辑模式此时输入:
:wq保存后退出
查看是否编辑成功

cat /etc/sysconfig/iptables

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置_13


重启防火墙

service iptables restart

3.2访问https://IP:8600/

此时,看到如下所示。

如何查看gitlab配置文件以及位置 如何查看gitlab版本_如何查看gitlab配置文件以及位置_14


在你的第一次访问,你将被重定向到一个密码重置屏幕。提供初始管理员帐户的密码,您将被重定向回登录屏幕。使用默认root用户名登录。

给root设置密码后,登录系统。至此Linux下安装GitLab完毕。

官网安装教程:https://about.gitlab.com/install/#centos-7