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

相关推荐
再睡一夏就好1 小时前
从硬件角度理解“Linux下一切皆文件“,详解用户级缓冲区
linux·服务器·c语言·开发语言·学习笔记
zm3 小时前
TCP 粘包
服务器·网络·php
伊成7 小时前
gitlab提交测试分支的命令和流程
gitlab
GBXLUO8 小时前
如何使用远程桌面控制电脑
服务器
搬码临时工8 小时前
电脑怎么远程访问服务器?4种常见的简单方法
运维·服务器·网络·异地访问
QQ2740287569 小时前
Kite AI 自动机器人部署教程
linux·运维·服务器·人工智能·机器人·web3
八月的雨季 最後的冰吻10 小时前
SIP协议栈--osip源码梳理
linux·服务器·网络·c++·网络协议
jllllyuz10 小时前
matlab实现蚁群算法解决公交车路径规划问题
服务器·前端·数据库
山师第一深情10 小时前
ssh connect to remote gitlab without authority
服务器·ssh·gitlab
敖云岚11 小时前
【Linux】基于虚拟机实现网络的管理
linux·服务器·网络