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)
=> #
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,就登录成功了。

你可能感兴趣的:(git,gitlab)