当前位置:   article > 正文

Ubuntu 20.04安装gitlab-ee_ubuntu gitlab-ee

ubuntu gitlab-ee

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

  1. curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
  2. 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、生成许可证

  1. sudo gem install gitlab-license
  2. #创建rb文件
  3. cd /etc/gitlab
  4. sudo vi license.rb

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

  1. require "openssl"
  2. require "gitlab/license"
  3. key_pair = OpenSSL::PKey::RSA.generate(2048)
  4. File.open("license_key", "w") { |f| f.write(key_pair.to_pem) }
  5. public_key = key_pair.public_key
  6. File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) }
  7. private_key = OpenSSL::PKey::RSA.new File.read("license_key")
  8. Gitlab::License.encryption_key = private_key
  9. license = Gitlab::License.new
  10. license.licensee = {
  11. "Name" => "none",
  12. "Company" => "none",
  13. "Email" => "example@test.com",
  14. }
  15. license.starts_at = Date.new(2020, 1, 1) # 开始时间
  16. license.expires_at = Date.new(2050, 1, 1) # 结束时间
  17. license.notify_admins_at = Date.new(2049, 12, 1)
  18. license.notify_users_at = Date.new(2049, 12, 1)
  19. license.block_changes_at = Date.new(2050, 1, 1)
  20. license.restrictions = {
  21. active_user_count: 10000,
  22. }
  23. puts "License:"
  24. puts license
  25. data = license.export
  26. puts "Exported license:"
  27. puts data
  28. File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) }
  29. public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub")
  30. Gitlab::License.encryption_key = public_key
  31. data = File.read("GitLabBV.gitlab-license")
  32. $license = Gitlab::License.import(data)
  33. puts "Imported license:"
  34. puts $license
  35. unless $license
  36. raise "The license is invalid."
  37. end
  38. if $license.restricted?(:active_user_count)
  39. active_user_count = 10000
  40. if active_user_count > $license.restrictions[:active_user_count]
  41. raise "The active user count exceeds the allowed amount!"
  42. end
  43. end
  44. if $license.notify_admins?
  45. puts "The license is due to expire on #{$license.expires_at}."
  46. end
  47. if $license.notify_users?
  48. puts "The license is due to expire on #{$license.expires_at}."
  49. end
  50. module Gitlab
  51. class GitAccess
  52. def check(cmd, changes = nil)
  53. if $license.block_changes?
  54. return build_status_object(false, "License expired")
  55. end
  56. end
  57. end
  58. end
  59. puts "This instance of GitLab Enterprise Edition is licensed to:"
  60. $license.licensee.each do |key, value|
  61. puts "#{key}: #{value}"
  62. end
  63. if $license.expired?
  64. puts "The license expired on #{$license.expires_at}"
  65. elsif $license.will_expire?
  66. puts "The license will expire on #{$license.expires_at}"
  67. else
  68. puts "The license will never expire."
  69. 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文件中

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

9、重启gitlab

  1. sudo gitlab-restart
  2. sudo gitlab-start

10、访问git,输入许可

http://192.168.85.129

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

上传GitLabBV.gitlab-license文件

 

 

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/682306
推荐阅读
相关标签
  

闽ICP备14008679号