内网安装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等第三方当代码仓库,

相关推荐
likfishdn2 分钟前
Linux的文件与目录管理
linux·运维·服务器
渲染101专业云渲染4 分钟前
川翔云电脑优势总结
服务器·3d·电脑·blender·maya
chian-ocean22 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=23 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
橘子味的茶二33 分钟前
高级系统架构师--第十章:计算机网络
服务器·计算机网络·系统架构
紫菜(Nori)1 小时前
短连接服务器压测-wrk
服务器·压力测试
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
Tisfy5 小时前
LeetCode 1472.设计浏览器历史记录:一个数组完成模拟,单次操作均O(1)
服务器·leetcode·浏览器·memcached·题解·模拟·数组
wanhengidc8 小时前
单线服务器和双线服务器分别是指什么?
运维·服务器
tekin8 小时前
基于 Python 开发在线多人游戏服务器案例解析
服务器·python·游戏·在线多人游戏服务器