内网安装GitLab

内网安装GitLab

为什么安装GitLab

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

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

下载

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

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

依赖安装

sh 复制代码
#安装相关依赖
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下载的包

sh 复制代码
# 安装
rpm -ivh gitlab-ee-16.10.6-ee.0.el7.x86_64.rpm

安装成功后输入以下信息

sh 复制代码
[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配置

sh 复制代码
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密码

sh 复制代码
#重置管理员登录密码
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

修改语言为中文

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

相关推荐
maomi_952613 分钟前
数据库学习通期末复习二
服务器·数据库
liyongjun63161 小时前
CentOS 下 Zookeeper 常用命令与完整命令列表
linux·服务器·zookeeper·centos
facaixxx20242 小时前
什么是巨型帧Jumbo Frames?云服务器开启巨型帧有什么用?
运维·服务器
巨可爱熊5 小时前
高并发内存池(定长内存池基础)
linux·运维·服务器·c++·算法
yangang1857 小时前
linuxbash原理
linux·运维·服务器
一一Null7 小时前
关于手机取证中逻辑采集与系统备份的差异
服务器·网络·智能手机
yangshuo12818 小时前
如何在服务器上搭建mail服务器邮件服务器
运维·服务器
独行soc8 小时前
2025年常见渗透测试面试题-红队面试宝典下(题目+回答)
linux·运维·服务器·前端·面试·职场和发展·csrf
小丁爱养花9 小时前
驾驭 Linux 云: JavaWeb 项目安全部署
java·linux·运维·服务器·spring boot·后端·spring
脑子慢且灵11 小时前
计算机操作系统——存储器管理
linux·服务器·windows·操作系统·存储器·存储器多级结构