gitlab搭建

Gitlab搭建

1.配置yum网络源:

[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-01-06 21:43:43--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.203.224.204, 124.203.224.199, 124.203.224.202, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.203.224.204|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘Centos-7.repo’

100%[======================================>] 2,523       --.-K/s   in 0.003s  

2020-01-06 21:43:43 (926 KB/s) - ‘Centos-7.repo’ saved [2523/2523]

[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/epel-7.repo
--2020-01-06 21:44:38--  http://mirrors.aliyun.com/repo/epel-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.203.225.20, 124.203.224.198, 124.203.224.201, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.203.225.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 664 [application/octet-stream]
Saving to: ‘epel-7.repo’

100%[======================================>] 664         --.-K/s   in 0s      

2020-01-06 21:44:38 (142 MB/s) - ‘epel-7.repo’ saved [664/664]

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls
Centos-7.repo  epel-7.repo
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum -y install lftp    //测试
Loaded plugins: fastestmirror, langpacks
base                                                     | 3.6 kB     00:00     
epel                                                     | 5.3 kB     00:00     
extras                                                   | 2.9 kB     00:00     
updates                                                  | 2.9 kB     00:00     
(1/7): base/7/x86_64/group_gz                              | 165 kB   00:00     
(2/7): epel/x86_64/group_gz                                |  90 kB   00:00     
(3/7): extras/7/x86_64/primary_db                          | 153 kB   00:01     
(4/7): epel/x86_64/updateinfo                              | 1.0 MB   00:04     
(5/7): base/7/x86_64/primary_db                            | 6.0 MB   00:06     
(6/7): updates/7/x86_64/primary_db                         | 5.9 MB   00:06     
(7/7): epel/x86_64/primary_db                              | 6.9 MB   00:07     
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package lftp.x86_64 0:4.4.8-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch             Version                   Repository      Size
================================================================================
Installing:
 lftp           x86_64           4.4.8-11.el7              base           752 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 752 k
Installed size: 2.4 M
Downloading packages:
lftp-4.4.8-11.el7.x86_64.rpm                               | 752 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : lftp-4.4.8-11.el7.x86_64                                     1/1 
  Verifying  : lftp-4.4.8-11.el7.x86_64                                     1/1 

Installed:
  lftp.x86_64 0:4.4.8-11.el7                                                    

Complete!

2.下载gitlab安装包到/usr/src/下:

[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
--2020-01-06 21:51:21--  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.1’

[root@localhost yum.repos.d]# cd /usr/src/
[root@localhost src]# ls
debug  gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm  kernels

3.安装git及相关依赖包:

[root@localhost src]# yum -y install git curl openssh-server openssh-clients postfix cronie policycoreutils-python
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Package git-1.8.3.1-20.el7.x86_64 already installed and latest version
Package curl-7.29.0-54.el7_7.1.x86_64 already installed and latest version
Package openssh-server-7.4p1-21.el7.x86_64 already installed and latest version
Package openssh-clients-7.4p1-21.el7.x86_64 already installed and latest version
Package matching 2:postfix-2.10.1-7.el7.x86_64 already installed. Checking for update.
Package cronie-1.4.11-23.el7.x86_64 already installed and latest version
Package policycoreutils-python-2.5-33.el7.x86_64 already installed and latest version
Nothing to do

4.启动postfix邮件服务并设置开机自启:

[root@localhost src]# systemctl start postfix;systemctl enable postfix

5.安装及配置gitlab:

[root@localhost src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm    //安装gitlab的rpm包
warning: gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing...                          ################################# [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 src]# vim /etc/gitlab/gitlab.rb        //修改gitlab配置文件
  12 ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-exte     rnal-url-for-gitlab
  13 external_url 'http://192.168.100.200'     //改为gitlab服务器的IP地址或域名
  14 
  15 ## Roles for multi-instance GitLab
  16 ##! The default is to have no roles enabled, which results in GitLab running as an a     ll-in-one instance.
  17 ##! Options:
  
[root@localhost src]# gitlab-ctl reconfigure      //重载配置文件,时间有些长 此处略
[root@localhost src]# gitlab-ctl restart        //重启服务
ok: run: alertmanager: (pid 41862) 1s
ok: run: gitaly: (pid 41878) 0s
ok: run: gitlab-monitor: (pid 41905) 0s
ok: run: gitlab-workhorse: (pid 41911) 1s
ok: run: logrotate: (pid 41922) 0s
ok: run: nginx: (pid 41929) 1s
ok: run: node-exporter: (pid 41937) 0s
ok: run: postgres-exporter: (pid 42018) 1s
ok: run: postgresql: (pid 42030) 0s
ok: run: prometheus: (pid 42038) 0s
ok: run: redis: (pid 42054) 1s
ok: run: redis-exporter: (pid 42058) 0s
ok: run: sidekiq: (pid 42069) 1s
ok: run: unicorn: (pid 42081) 0s

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

[root@localhost src]# 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 = 'duolaameng'
=> "duolaameng"
irb(main):003:0> user.password_confirmation = 'duolaameng'
=> "duolaameng"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 92e6033c-2049-4163-ab96-a1db8678cacd) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):005:0> exit

![在这里插入图片描述](https://img-blog.csdnimg.cn/20200107113941645.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDU1NjY4OA==,size_16,color_FFFFFF,t_70)

![在这里插入图片描述](https://img-blog.csdnimg.cn/20200107114459845.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDU1NjY4OA==,size_16,color_FFFFFF,t_70)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值