GitLab下載、安裝和初次登錄

一、下載

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

二、安裝

下載到指定目錄後,就可以執行以下命令:

rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

執行成功後,會生成/etc/gitlab/gitlab.rb這麼一個文件,修改其中監聽的url和端口號:

## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://172.17.xx.xx:80'                                                                                                                                                                                                                                   

將其中的external_url值的ip修改成當前機器的ip,端口號取80或其他值。保存退出後,順序執行以下命令:

[root@i ~]# gitlab-ctl reconfigure
[root@i ~]# gitlab-ctl restart
[root@i ~]# gitlab-ctl status
run: gitaly: (pid 25838) 2791s; run: log: (pid 20137) 4936s
run: gitlab-monitor: (pid 25847) 2790s; run: log: (pid 20346) 4910s
run: gitlab-workhorse: (pid 25860) 2790s; run: log: (pid 20204) 4929s
run: logrotate: (pid 25870) 2790s; run: log: (pid 20267) 4922s
run: nginx: (pid 32117) 1s; run: log: (pid 20211) 4928s
run: node-exporter: (pid 25914) 2789s; run: log: (pid 20329) 4916s
run: postgres-exporter: (pid 25920) 2788s; run: log: (pid 20394) 4902s
run: postgresql: (pid 25929) 2788s; run: log: (pid 19957) 4975s
run: prometheus: (pid 25937) 2787s; run: log: (pid 20376) 4903s
run: redis: (pid 25945) 2787s; run: log: (pid 19897) 4981s
run: redis-exporter: (pid 25951) 2787s; run: log: (pid 20360) 4909s
run: sidekiq: (pid 25961) 2784s; run: log: (pid 20119) 4942s
run: unicorn: (pid 25985) 2783s; run: log: (pid 20081) 4944s

此時可以看到gitlab是運行的狀態,如果在瀏覽器地址欄輸入對應的ip,是可以看到登錄頁面的。就此安裝完成!

三、登錄

登錄時需要賬號和密碼的,但此時並不知道賬號密碼是多少。可以執行以下命令:

[root@i ~]# gitlab-rails console production
Loading production environment (Rails 4.2.8)
irb(main):001:0> u=User.find(1)
=> #<User id:1 @root>
irb(main):002:0> u.password='test123456'
=> "test123456"
irb(main):003:0> u.save
Enqueued ActionMailer::DeliveryJob (Job ID: 1657620e-55fb-4786-a0d1-dec1fbc1421d) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):004:0> exit
[root@i ~]# 

首先是通過find方法找到id爲1的用戶,也就是root,然後修改它的密碼爲test123456,設置好密碼後必須執行u.save才能夠生效,之後輸入exit退出。

此時在之前打開的瀏覽器頁面輸入賬號root密碼test123456,就登錄成功了。

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章