3.15 gitlab部署

常用版本控制工具

常用的版本控制工具:

  • gitlab
  • subversion
  • 碼雲(收費)

gitlab部署

//配置yum源
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2018-08-10 12:07:17--  http://mirrors.163.com/.help/CentOS7-Base-163.repo
Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251
Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1572 (1.5K) [application/octet-stream]
Saving to: ‘CentOS7-Base-163.repo’

100%[=================================>] 1,572       --.-K/s   in 0s

2018-08-10 12:07:17 (191 MB/s) - ‘CentOS7-Base-163.repo’ saved [1572/1572]
[root@localhost ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# yum -y install epel-release
安裝過程略。。。。

//安裝git
[root@localhost ~]# yum -y install epel-release git
安裝過程略

//安裝依賴包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
安裝過程略....

//啓動postfix服務並設置開機自啓
[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl enable postfix

//下載gitlab的rpm包
[root@localhost ~]# cd /usr/src/
[root@localhost src]# ls
debug  kernels
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
--2018-08-25 11:03:16--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 444944490 (424M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm’

[root@localhost src]# ls
debug  gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm  kernels

//安裝gitlab
[root@localhost src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing...                                                            (1################################# [100%]
Updating / installing...
   1:gitlab-ce-11.2.1-ce.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


//修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
......  //此處爲省略內容
external_url 'http://172.16.12.128'     //將此處設爲gitlab的服務器ip地址亦或域名
......  //此處爲省略內容

//重載配置文件並重啓gitlab
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 17305) 0s
ok: run: gitaly: (pid 17318) 0s
ok: run: gitlab-monitor: (pid 17331) 0s
ok: run: gitlab-workhorse: (pid 17335) 0s
ok: run: logrotate: (pid 17363) 1s
ok: run: nginx: (pid 17369) 0s
ok: run: node-exporter: (pid 17380) 1s
ok: run: postgres-exporter: (pid 17386) 0s
ok: run: postgresql: (pid 17396) 1s
ok: run: prometheus: (pid 17405) 0s
ok: run: redis: (pid 17420) 0s
ok: run: redis-exporter: (pid 17425) 0s
ok: run: sidekiq: (pid 17510) 0s
ok: run: unicorn: (pid 17523) 0s

//查看當前的gitlab版本
[root@localhost ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 11.2.1


//破解管理員密碼
[root@localhost ~]# gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       11.2.1 (2d6c1c6)
 GitLab Shell: 8.1.1
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> user = User.where(id: 1).first     //id爲1的是超級管理員
=> #<User id:1 @root>
irb(main):002:0> user.password = 'wangqing123!'     //密碼必須至少8個字符
=> "wangqing123!"
irb(main):003:0> user.password_confirmation = 'wangqing123!'
irb(main):004:0> user.save!     //保存修改,若無問題將返回true
Enqueued ActionMailer::DeliveryJob (Job ID: 7feb0464-15aa-4151-be94-2e657a65494e) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):005:0> exit   //退出
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章