gitlab部署

安装git

[root@localhost ~]# dnf -y install telnet

安装依赖包

[root@localhost ~]# dnf -y install curl openssh-server openssh-clients postfix cronie python3-policycoreutils

启动postfix服务并设置开机自动启动

[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl enable postfix

下载gitlab apm包

[root@localhost ~]# wget -c https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm

安装 gitlab

[root@localhost ~]# rpm -ivh gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm 
warning: gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:gitlab-ce-13.9.7-ce.0.el8        ################################# [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=13-9

修改配置文件

[root@localhost ~]# vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.59.131'     #将此处设为gitlab的服务器ip地址亦或域名

重载配置文件并重启

[root@localhost ~]# gitlab-ctl reconfigure
.....省略
Running handlers:
Running handlers complete
Chef Infra Client finished, 30/848 resources updated in 01 minutes 12 seconds
gitlab Reconfigured!

[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 3065) 1s
ok: run: gitaly: (pid 3072) 1s
ok: run: gitlab-exporter: (pid 3098) 0s
ok: run: gitlab-workhorse: (pid 3101) 1s
ok: run: grafana: (pid 3107) 0s
ok: run: logrotate: (pid 3116) 1s
ok: run: nginx: (pid 3126) 0s
ok: run: node-exporter: (pid 3131) 1s
ok: run: postgres-exporter: (pid 3211) 0s
ok: run: postgresql: (pid 3219) 1s
ok: run: prometheus: (pid 3228) 0s
ok: run: puma: (pid 3240) 0s
ok: run: redis: (pid 3245) 1s
ok: run: redis-exporter: (pid 3251) 0s
ok: run: sidekiq: (pid 3262) 0s
查看当前gitlab版本
[root@localhost ~]# head -1 /opt/gitlab/version-manifest.txt 
gitlab-ce 13.9.7

破解密码

[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
 GitLab:       13.9.7 (05f9b5a73c8) FOSS
 GitLab Shell: 13.17.0
 PostgreSQL:   12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.4)

irb(main):014:0> user = User.where(id: 1).first
=> #<User id:1 @root> #id位1 是超级管理员
irb(main):015:0> user.password = "4564949a"
=> "4564949a" #密码至少8位
irb(main):016:0> user.password_confirmation = "4564949a"
=> "4564949a" #确认
irb(main):017:0> user.save!  #保存
Enqueued ActionMailer::MailDeliveryJob (Job ID: a2713698-1457-4790-9e3f-064aa836e30c) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f8e6884b7e8 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):018:0> exit   #退出
[root@localhost ~]# 

 




posted @ 2021-06-18 08:30  #44  阅读(90)  评论(0)    收藏  举报