内网安装GitLab

内网安装GitLab

为什么安装GitLab

GitHub(国外)和Gitee(国内)都是第三方托管平台,不能本地部署,对公网开放,代码保密性不高。

为代码保密性,需在内网搭建代码管理平台。有web操作页面,所以选择GitLab。

下载

地址:https://packages.gitlab.com/gitlab/gitlab-ee

【注意】:el/7,el/8,el/9 分别对应centos7、8、9,不同服务器操作系统下载不同的安装包

image-20240611154405541

依赖安装

#安装相关依赖
sudo yum install -y curl policycoreutils openssh-server openssh-clients
#启动ssh服务、设置为开机自启动
sudo systemctl enable sshd
sudo systemctl start sshd
#安装postfix以发送邮件通知
sudo yum install -y postfix
#启动postfix服务、设置为开机自启动
sudo systemctl enable postfix
sudo systemctl start postfix
#开放http服务、重启防火墙
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

安装GitLab

上传下载的rpm包,或者curl、wget下载的包

# 安装
rpm -ivh gitlab-ee-16.10.6-ee.0.el7.x86_64.rpm

安装成功后输入以下信息

[root@localhost gitlab]# rpm -ivh gitlab-ee-16.10.6-ee.0.el9.x86_64.rpm 
警告:gitlab-ee-16.10.6-ee.0.el9.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ee-16.10.6-ee.0.el9       ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=16-10

修改Gitlab配置

vi /etc/gitlab/gitlab.rb
#修改以下内容:
external_url 'http://gitlab.example.com'
#更改 https://gitlab.example.com 为要访问极狐GitLab实例的URL
external_url 'http://ip' # f

#重新加载配置
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
#开放指定端口(注意80端口被占用)
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

修改root密码

#重置管理员登录密码
su - git        #切换用户
gitlab-rails console -e production  #进入GitLab控制台
user = User.where(id: 1).first      #查询gitlab超级管理员信息,超级管理员用户默认是1
user.password='12345678'        #修改密码
user.save!      #保存用户对象
exit        #退出控制台

#登录默认端口80
http://id:80

image-20240611163912533

修改语言为中文

image-20240611164246392

从GitHub等第三方当代码仓库,

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值