Skip to content

centos7.9环境下

gitlab-ee.16.0.0

1.下载

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

或者

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/

2.安装

bash
[root@k8s-master01 ~]# rpm -ivh gitlab-ee-16.0.0-ee.0.el7.x86_64.rpm 
警告:gitlab-ee-16.0.0-ee.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ee-16.0.0-ee.0.el7        ################################# [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-0
[root@k8s-master01 ~]# rpm -ivh gitlab-ee-16.0.0-ee.0.el7.x86_64.rpm 
警告:gitlab-ee-16.0.0-ee.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ee-16.0.0-ee.0.el7        ################################# [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-0
  • 修改配置
vim /etc/gitlab/gitlab.rb
vim /etc/gitlab/gitlab.rb
  • 初始化
gitlab-ctl reconfigure
gitlab-ctl reconfigure
  • 查密码
cat /etc/gitlab/initial_root_password
cat /etc/gitlab/initial_root_password
  • 访问

http://ip

3.破解

3.1安装ruby

3.1.0安装

bash
yum install centos-release-scl-rh    # 会在/etc/yum.repos.d/目录下多出一个CentOS-SCLo-scl-rh.repo源

yum install -y rh-ruby27   # 直接yum安装即可  

scl enable rh-ruby27 bash    # 启用哪个版本
yum install centos-release-scl-rh    # 会在/etc/yum.repos.d/目录下多出一个CentOS-SCLo-scl-rh.repo源

yum install -y rh-ruby27   # 直接yum安装即可  

scl enable rh-ruby27 bash    # 启用哪个版本

3.1.1查看版本

bash
[root@k8s-master01 gitlab]# ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]

[root@k8s-master01 gitlab]# gem -v 
3.1.6
[root@k8s-master01 gitlab]# ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]

[root@k8s-master01 gitlab]# gem -v 
3.1.6

3.1.2安装gitlab-license

bash
[root@k8s-master01 gitlab]# gem install gitlab-license
Fetching gitlab-license-2.2.2.gem
Successfully installed gitlab-license-2.2.2
Parsing documentation for gitlab-license-2.2.2
Installing ri documentation for gitlab-license-2.2.2
Done installing documentation for gitlab-license after 0 seconds
1 gem installed
[root@k8s-master01 gitlab]# gem install gitlab-license
Fetching gitlab-license-2.2.2.gem
Successfully installed gitlab-license-2.2.2
Parsing documentation for gitlab-license-2.2.2
Installing ri documentation for gitlab-license-2.2.2
Done installing documentation for gitlab-license after 0 seconds
1 gem installed
  • 创建license文件
bash
cd /var/opt/gitlab/backups
touch license.rb
cd /var/opt/gitlab/backups
touch license.rb
  • vi license.rb
ruby

    require "openssl"
    require "gitlab/license"
    key_pair = OpenSSL::PKey::RSA.generate(2048)
    File.open("license_key", "w") { |f| f.write(key_pair.to_pem) }
    public_key = key_pair.public_key
    File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) }
    private_key = OpenSSL::PKey::RSA.new File.read("license_key")
    Gitlab::License.encryption_key = private_key
    license = Gitlab::License.new
    license.licensee = {
    "Name" => "none",
    "Company" => "none",
    "Email" => "example@test.com",
    }
    license.starts_at = Date.new(2021, 1, 1) # 开始时间
    license.expires_at = Date.new(2050, 1, 1) # 结束时间
    license.notify_admins_at = Date.new(2049, 12, 1)
    license.notify_users_at = Date.new(2049, 12, 1)
    license.block_changes_at = Date.new(2050, 1, 1)
    license.restrictions = {
    active_user_count: 10000,
    }
    puts "License:"
    puts license
    data = license.export
    puts "Exported license:"
    puts data
    File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) }
    public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub")
    Gitlab::License.encryption_key = public_key
    data = File.read("GitLabBV.gitlab-license")
    $license = Gitlab::License.import(data)
    puts "Imported license:"
    puts $license
    unless $license
    raise "The license is invalid."
    end
    if $license.restricted?(:active_user_count)
    active_user_count = 10000
    if active_user_count > $license.restrictions[:active_user_count]
        raise "The active user count exceeds the allowed amount!"
    end
    end
    if $license.notify_admins?
    puts "The license is due to expire on #{$license.expires_at}."
    end
    if $license.notify_users?
    puts "The license is due to expire on #{$license.expires_at}."
    end
    module Gitlab
    class GitAccess
        def check(cmd, changes = nil)
        if $license.block_changes?
            return build_status_object(false, "License expired")
        end
        end
    end
    end
    puts "This instance of GitLab Enterprise Edition is licensed to:"
    $license.licensee.each do |key, value|
    puts "#{key}: #{value}"
    end
    if $license.expired?
    puts "The license expired on #{$license.expires_at}"
    elsif $license.will_expire?
    puts "The license will expire on #{$license.expires_at}"
    else
    puts "The license will never expire."
    end

    require "openssl"
    require "gitlab/license"
    key_pair = OpenSSL::PKey::RSA.generate(2048)
    File.open("license_key", "w") { |f| f.write(key_pair.to_pem) }
    public_key = key_pair.public_key
    File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) }
    private_key = OpenSSL::PKey::RSA.new File.read("license_key")
    Gitlab::License.encryption_key = private_key
    license = Gitlab::License.new
    license.licensee = {
    "Name" => "none",
    "Company" => "none",
    "Email" => "example@test.com",
    }
    license.starts_at = Date.new(2021, 1, 1) # 开始时间
    license.expires_at = Date.new(2050, 1, 1) # 结束时间
    license.notify_admins_at = Date.new(2049, 12, 1)
    license.notify_users_at = Date.new(2049, 12, 1)
    license.block_changes_at = Date.new(2050, 1, 1)
    license.restrictions = {
    active_user_count: 10000,
    }
    puts "License:"
    puts license
    data = license.export
    puts "Exported license:"
    puts data
    File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) }
    public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub")
    Gitlab::License.encryption_key = public_key
    data = File.read("GitLabBV.gitlab-license")
    $license = Gitlab::License.import(data)
    puts "Imported license:"
    puts $license
    unless $license
    raise "The license is invalid."
    end
    if $license.restricted?(:active_user_count)
    active_user_count = 10000
    if active_user_count > $license.restrictions[:active_user_count]
        raise "The active user count exceeds the allowed amount!"
    end
    end
    if $license.notify_admins?
    puts "The license is due to expire on #{$license.expires_at}."
    end
    if $license.notify_users?
    puts "The license is due to expire on #{$license.expires_at}."
    end
    module Gitlab
    class GitAccess
        def check(cmd, changes = nil)
        if $license.block_changes?
            return build_status_object(false, "License expired")
        end
        end
    end
    end
    puts "This instance of GitLab Enterprise Edition is licensed to:"
    $license.licensee.each do |key, value|
    puts "#{key}: #{value}"
    end
    if $license.expired?
    puts "The license expired on #{$license.expires_at}"
    elsif $license.will_expire?
    puts "The license will expire on #{$license.expires_at}"
    else
    puts "The license will never expire."
    end
  • 生成文件
bash
#生成 GitLabBV.gitlab-license license_key license_key.pub 这三个文件

cd /var/opt/gitlab/backups
ruby license.rb

License:
#<Gitlab::License:0x0000000001f4dac0>
Exported license:
eyJkYXRhIjoib0I1YjgzUXMzY0s4VDBMNndrNXJ2Y1JnQ0o3VzNIMkxsWFlp
Ri9sUTNuakI0bGpBSVJhc21XUjQ2dy81XG5JTCtDVlBKQnM3Q01sai81Z2lm
cnplcHJUZkxKd1JGUFM1NHlxeUFzeHdoajNGbFlnSEdTa1ZoME1jQ1Bcbkl5
bkcxMTVPbUplMzNnc3R6NDN6amNaUjlsa0tjR3ZGN1hKSWd3Q1ZBNTFjcHdw
dG81MkpTK2RWMkREcFxuN3NWc1Iydk5vQnpYT05Yc05vVjZwamd6c25IQUVX
RXpKejJlNFdyU09scUNQaGJuRDdqYjFVQWQzVjhoXG5BVXN1ek9rT2xqTHZX
U3E0MklOcFRxVWJ1NHdQUEl3M1d6N011d0FsQkpNb2drcnRtWk5NeUEyVUVi
T25cbkZKemhDZkJrdllQTU9xT1VWUDdWWnJoczlCTGpTNmhCRXZzbnM5UzFD
TFhHb1FJRjkwVzFLdG5La09ZbVxuTitUYTFLbGVkdFROMTVGczFRTjV5L3B5
UnJRZUlwK0JNTklWOC9ZQWhoSmkrb2JObVdMT29EVTYwbjhBXG5LcEpMekZL
VVBHR0UrYmlIV1NuWm5TYjloOWY5aTJBdk1ueVRYWE14WFI5bExjd1lPa3RD
b0ljRC9PdVpcbllBdzBRQ3BJNXJNbm5VZFZISmh1bGJmQ3A4amNNMEdiN2JX
MG5EMEI5K1UzVDlZYlNvL2RRVmNpeDJIY1xuK0xBNnhBMDF0VGlSUnNzL2Rp
RWppM3BWSHZCejhTcFhxSm53UnNlWlVOM0dWZndIUkt5VkgvNDN3Sk56XG5s
RGU5bDU2bis5R2hFaXVpWTl0UjloSGVzTWE0UlFiLytJUGVMcnJKT1B4ZXJp
SDFiOWJiWUx1Z2hRdEZcblJRPT1cbiIsImtleSI6IkQ5NURWWHdLUWR5K1JP
Qm5FNnByVndzbFQ4cDNWUmNVd1ZzdnVtWm5Ub09mTUdPUTFNSkNuTy9vRHpj
d1xuN0Jid3p5WFg2S2RtNE8xZGlIZzdZVWJqL1ZxMjFHZkl6OEU2VVU1ZVZw
dVBEbXA1SHp4RG1mUkxCUllDXG5BQ1lKZDY0NDV6RG1lN3ZlV1BqYVFvNTg5
T3JqakcxU3ZxVEJhNmhWRWFWUDM1YnNZUUtmcEFCVWdmTThcbk1YZS82VkF4
a1FrcEY5M2pxa3E4MkxzTERSYzY4YzNCbDN1MGRUamg2WDJJV3BmaHZqUE9p
Y0lrL2JhQlxuK3pxZFNURUxoUjRwMWs3aHVKb0o0V2ZVS1hpbzgxL2RuQUxi
a3JRaXRnN3dCSnZTZHhEQ1NvM0RlQVd2XG5XZ1dMS2FXZldMSTFWaTM1Qk4x
b1ljckhOTm0yc2FjaWh2bnhBeG5nbHc9PVxuIiwiaXYiOiJNWWduRER4WXJZ
QWY3NXMzSjRENTVRPT1cbiJ9
Imported license:
#<Gitlab::License:0x0000000002243ab8>
This instance of GitLab Enterprise Edition is licensed to:
Name: none
Company: none
Email: example@test.com
The license will expire on 2050-01-01



#生成三个文件
[root@k8s-master01 backups]# ll
总用量 16
-rw-r--r-- 1 root root 1489 5  29 15:06 GitLabBV.gitlab-license
-rw-r--r-- 1 root root 1675 5  29 15:06 license_key
-rw-r--r-- 1 root root  451 5  29 15:06 license_key.pub
#生成 GitLabBV.gitlab-license license_key license_key.pub 这三个文件

cd /var/opt/gitlab/backups
ruby license.rb

License:
#<Gitlab::License:0x0000000001f4dac0>
Exported license:
eyJkYXRhIjoib0I1YjgzUXMzY0s4VDBMNndrNXJ2Y1JnQ0o3VzNIMkxsWFlp
Ri9sUTNuakI0bGpBSVJhc21XUjQ2dy81XG5JTCtDVlBKQnM3Q01sai81Z2lm
cnplcHJUZkxKd1JGUFM1NHlxeUFzeHdoajNGbFlnSEdTa1ZoME1jQ1Bcbkl5
bkcxMTVPbUplMzNnc3R6NDN6amNaUjlsa0tjR3ZGN1hKSWd3Q1ZBNTFjcHdw
dG81MkpTK2RWMkREcFxuN3NWc1Iydk5vQnpYT05Yc05vVjZwamd6c25IQUVX
RXpKejJlNFdyU09scUNQaGJuRDdqYjFVQWQzVjhoXG5BVXN1ek9rT2xqTHZX
U3E0MklOcFRxVWJ1NHdQUEl3M1d6N011d0FsQkpNb2drcnRtWk5NeUEyVUVi
T25cbkZKemhDZkJrdllQTU9xT1VWUDdWWnJoczlCTGpTNmhCRXZzbnM5UzFD
TFhHb1FJRjkwVzFLdG5La09ZbVxuTitUYTFLbGVkdFROMTVGczFRTjV5L3B5
UnJRZUlwK0JNTklWOC9ZQWhoSmkrb2JObVdMT29EVTYwbjhBXG5LcEpMekZL
VVBHR0UrYmlIV1NuWm5TYjloOWY5aTJBdk1ueVRYWE14WFI5bExjd1lPa3RD
b0ljRC9PdVpcbllBdzBRQ3BJNXJNbm5VZFZISmh1bGJmQ3A4amNNMEdiN2JX
MG5EMEI5K1UzVDlZYlNvL2RRVmNpeDJIY1xuK0xBNnhBMDF0VGlSUnNzL2Rp
RWppM3BWSHZCejhTcFhxSm53UnNlWlVOM0dWZndIUkt5VkgvNDN3Sk56XG5s
RGU5bDU2bis5R2hFaXVpWTl0UjloSGVzTWE0UlFiLytJUGVMcnJKT1B4ZXJp
SDFiOWJiWUx1Z2hRdEZcblJRPT1cbiIsImtleSI6IkQ5NURWWHdLUWR5K1JP
Qm5FNnByVndzbFQ4cDNWUmNVd1ZzdnVtWm5Ub09mTUdPUTFNSkNuTy9vRHpj
d1xuN0Jid3p5WFg2S2RtNE8xZGlIZzdZVWJqL1ZxMjFHZkl6OEU2VVU1ZVZw
dVBEbXA1SHp4RG1mUkxCUllDXG5BQ1lKZDY0NDV6RG1lN3ZlV1BqYVFvNTg5
T3JqakcxU3ZxVEJhNmhWRWFWUDM1YnNZUUtmcEFCVWdmTThcbk1YZS82VkF4
a1FrcEY5M2pxa3E4MkxzTERSYzY4YzNCbDN1MGRUamg2WDJJV3BmaHZqUE9p
Y0lrL2JhQlxuK3pxZFNURUxoUjRwMWs3aHVKb0o0V2ZVS1hpbzgxL2RuQUxi
a3JRaXRnN3dCSnZTZHhEQ1NvM0RlQVd2XG5XZ1dMS2FXZldMSTFWaTM1Qk4x
b1ljckhOTm0yc2FjaWh2bnhBeG5nbHc9PVxuIiwiaXYiOiJNWWduRER4WXJZ
QWY3NXMzSjRENTVRPT1cbiJ9
Imported license:
#<Gitlab::License:0x0000000002243ab8>
This instance of GitLab Enterprise Edition is licensed to:
Name: none
Company: none
Email: example@test.com
The license will expire on 2050-01-01



#生成三个文件
[root@k8s-master01 backups]# ll
总用量 16
-rw-r--r-- 1 root root 1489 5  29 15:06 GitLabBV.gitlab-license
-rw-r--r-- 1 root root 1675 5  29 15:06 license_key
-rw-r--r-- 1 root root  451 5  29 15:06 license_key.pub
  • 查看没有激活之前的状态

菜单->管理员->订阅(http://192.168.177.130/admin/subscription)

  • 开始激活
bash
#覆盖新的key.pub
cp license_key.pub /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
#覆盖新的key.pub
cp license_key.pub /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
  • 修改等级
bash
  --- /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
  +++ /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
  @@ -367,7 +367,7 @@
  end

  def plan
  -    restricted_attr(:plan).presence || STARTER_PLAN
  +    restricted_attr(:plan).presence || ULTIMATE_PLAN
  end

  def edition
  --- /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
  +++ /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
  @@ -367,7 +367,7 @@
  end

  def plan
  -    restricted_attr(:plan).presence || STARTER_PLAN
  +    restricted_attr(:plan).presence || ULTIMATE_PLAN
  end

  def edition
  • 重启gitlab服务
bash
gitlab-ctl restart
gitlab-ctl restart
  • Gitlab添加许可证
bash
http://${your_gitlab_server_address}/admin/application_settings/general
http://${your_gitlab_server_address}/admin/application_settings/general
展开 add license
上传,GitLabBV.gitlab-license
勾选Enter license key, 填入license,
勾选terms of service 点击add license按钮,
展开 add license
上传,GitLabBV.gitlab-license
勾选Enter license key, 填入license,
勾选terms of service 点击add license按钮,
  • 激活成功