打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
gitlab run成功 但无法访问

gitlab是一个开源的git仓库管理软件,并提供web界面,方便管理git仓库。考虑到安全、费用,公司一般选择搭建自己的gitlab服务器。

本文将按照官方文档安装步骤,一步步进行gitlab的安装。

查看Linux版本信息

查看Linux系统的版本信息:

cat /proc/version

查看Linux系统发行版信息:

cat /etc/redhat-release

安装和配置必要的依赖

https://docs.gitlab.com/ee/install/README.html

在Linux系统中安装gitlab,对系统的相关最低要求,可以点击如下图椭圆标注内容进行查看。

使用官方的rpm安装包进行安装

进入如下图页面,根据当前Linux系统版本情况进行选择,此处选择CentOS7

https://about.gitlab.com/install/

安装和配置必要的依赖

  1. sudo yum install -y curl policycoreutils-python openssh-server
  2. sudo systemctl enable sshd
  3. sudo systemctl start sshd
  4. sudo firewall-cmd --permanent --add-service=http
  5. sudo firewall-cmd --permanent --add-service=https
  6. sudo systemctl reload firewalld

此处,对于通知邮件的相关指令暂时先不执行。

上图中提示“FirewallD is not running”问题。执行如下指令查看firewalld状态,结果当前是dead状态,即防火墙未开启

systemctl status firewalld

执行如下指令,开启防火墙

systemctl start firewalld

此时,再次查看防火墙的状态

systemctl status firewalld

此时,再次尝试执行如下指令,查看是否问题已解决。

  1. sudo firewall-cmd --permanent --add-service=http
  2. sudo firewall-cmd --permanent --add-service=https
  3. sudo systemctl reload firewalld

从上图可以看到,已经执行成功。

下载和安装gitlab

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

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

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

sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

此时,安装完成。

修改gitlab配置文件

vi /etc/gitlab/gitlab.rb

修改上图中椭圆标注的内容为当前Linux系统实际的ip地址和给gitlab分配的端口号。如下

https://192.168.0.21:8600

由于在上文中防火墙已开启,则需要把相应的端口8600放开。

firewall-cmd --zone=public --add-port=8600/tcp --permanent

使gitlab的配置文件生效

sudo gitlab-ctl reconfigure

重启gitlab

sudo gitlab-ctl restart

此时,在浏览器中输入gitlab的ip和端口号,无法访问。

linux系统开放8600端口

  1. cd /etc/sysconfig
  2. ls -l

没有查看到iptables文件,但存在ip6tables-config和iptables-config,本文中的linux为CentOS 7.6 ,CentOS 7默认没有了iptables文件。

安装iptables-services

yum install iptables-services

启动iptables

  1. systemctl enable iptables 
  2. systemctl start iptables 

在iptables中配置开放8600端口

vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8600 -j ACCEPT

重启防火墙

service iptables restart

首次进入gitlab

首次进入,会被导向到一个重置密码的页面,设置完成后会被导向到登录页面,可以使用默认账号root进行登录。

此时,在浏览器中访问,出现了gitlab页面,https://gitlab的ip:端口

登录成功后,进入到主操作页面,如下图。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Linux系统如何关闭防火墙?方法介绍!
CentOS7 防火墙配置(关闭)
SecrueCRT连接linux需要关闭linux防火墙_Centos 6.4 iptables防火墙关闭启动详解
Centos 7 使用(Service iptables stop/start)关闭/打开防火墙 Failed to stop iptables.service: Unit iptables.serv
Centos7 关闭防火墙
Linux firewall
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服