准备工作
- 一个服务器有无公网ip都可以, 2c8g及以上, 并且安装了Ubuntu24.x
- 一个域名
- 一个frp服务器(如果你没有公网ip)
安装依赖
首先执行以下命令来安装必要的依赖库
$ sudo apt-get update
$ sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
安装Postfix
$ sudo apt-get install -y postfix
添加Gitlab仓库
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
安装最新版Gitlab-ee
$ apt-get install gitlab-ee
配置Gitlab
打开 /etc/gitlab/gitlab.rb 修改external_url为你的域名例如https://repo.rtast.cn 如果你公开你的实例那么可以将external_url设置成内网可以访问的地址并加上端口号, 然后就配置结束了
如果你打算公开gitlab实例就设置external_url为域名并且加上https://, 使用vim的搜索模式搜索 nginx 然后找到以下内容
nginx['listen_port'] = 3000
修改一个没有被占用的端口, 然后打开你的nginx添加以下内容到 /etc/nginx/site-available/example.com
server {
listen 3001 ssl;
server_name repo.rtast.cn;
ssl_certificate /etc/letsencrypt/live/rtast.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/rtast.cn/privkey.pem;
location / {
client_max_body_size 512M;
proxy_pass https://localhost:3000;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
}
}
然后使用frp将3001暴露至公网
破解Gitlab-EE
首先你需要安装ruby解释器使用如下命令安装
$ sudo apt install ruby
$ ruby -v # 测试是否安装成功出现版本号就说明成功了
$ sudo gem install gitlab-license # 安装证书生成工具
然后创建一个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
将
license.licensee
中的内容更改成你公司名称邮件地址
然后运行这个rb文件使用
$ ruby license.rb
运行完成之后会出现3个文件分别是私钥文件license_key
和公钥文件 license_key,pub
证书文件 GitLabBV.gitlab-license
你需要修改/opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
将这个文件的内容替换成 license_key.pub
然后修改/opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
搜索 def plan
将restricted_attr(:plan).presence || STARTER_PLAN
更改为 restricted_attr(:plan).presence || ULTIMATE_PLAN
然后重新配置gitlab并重启
$ gitlab-ctl reconfigure
$ gitlab-ctl restart
最后打开WebUI进入 Admin Area - General - Add License
将GitLabBV.gitlab-license
这个文件上传或者粘贴 点击Add license就完成了
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:xiaoman1221@yhdzz.cn,工作室将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有。