1、安装依赖

sudo apt-get update

sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

 

 2、邮件服务器

sudo apt-get install -y postfix

3、安装gitlab

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
sudo EXTERNAL_URL="http://192.168.85.129" apt-get install gitlab-ee

 

4、访问登录

http://192.168.85.129/

默认账户名是root,密码存放在配置文件 /etc/gitlab/initial_root_password

5、自定义设置

更改初始密码、首选项等。

6、安装ruby

sudo apt-get install ruby

7、生成许可证

sudo gem install gitlab-license

#创建rb文件
cd /etc/gitlab
sudo vi license.rb

内容如下(注意尾部不要换行):

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(2020, 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

生成许可证

sudo ruby /etc/gitlab/license.rb

生成 GitLabBV.gitlab-license license_key license_key.pub 这三个文件

8、使用许可证

用 license_key.pub 文件内容替换至 /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub文件中

cd /opt/gitlab/embedded/service/gitlab-rails/
#替换文件内容
sudo vi .license_encryption_key.pub

9、重启gitlab

sudo gitlab-restart
sudo gitlab-start

10、访问git,输入许可

http://192.168.85.129

菜单--管理员--设置--通用--添加证

上传GitLabBV.gitlab-license文件

 

 

 

 

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐