在CentOS上安装GitLab-CI以及运行Runner的方法步骤

使用如下命令进行下载资源包

[root@yuyoho ~]# curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash

 接着,使用如下命令进行安装

[root@yuyoho ~]# yum install gitlab-runner
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package gitlab-ci-multi-runner.x86_64 0:9.5.1-1 will be installed
--> Processing Dependency: git for package: gitlab-ci-multi-runner-9.5.1-1.x86_64
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-23.el7_8 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-23.el7_8 for package: git-1.8.3.1-23.el7_8.x86_64
--> Processing Dependency: rsync for package: git-1.8.3.1-23.el7_8.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-23.el7_8.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-23.el7_8.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-23.el7_8.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-23.el7_8 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
---> Package rsync.x86_64 0:3.1.2-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package                     Arch        Version                  Repository                          Size
===========================================================================================================
Installing:
 gitlab-ci-multi-runner      x86_64      9.5.1-1                  runner_gitlab-ci-multi-runner       24 M
Installing for dependencies:
 git                         x86_64      1.8.3.1-23.el7_8         updates                            4.4 M
 perl-Error                  noarch      1:0.17020-2.el7          base                                32 k
 perl-Git                    noarch      1.8.3.1-23.el7_8         updates                             56 k
 perl-TermReadKey            x86_64      2.30-20.el7              base                                31 k
 rsync                       x86_64      3.1.2-10.el7             base                               404 k

Transaction Summary
===========================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 29 M
Installed size: 69 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): perl-Git-1.8.3.1-23.el7_8.noarch.rpm                                         |  56 kB  00:00:00     
(2/6): perl-TermReadKey-2.30-20.el7.x86_64.rpm                                      |  31 kB  00:00:00     
(3/6): perl-Error-0.17020-2.el7.noarch.rpm                                          |  32 kB  00:00:00     
(4/6): rsync-3.1.2-10.el7.x86_64.rpm                                                | 404 kB  00:00:00     
(5/6): git-1.8.3.1-23.el7_8.x86_64.rpm                                              | 4.4 MB  00:00:01     
(6/6): gitlab-ci-multi-runner-9.5.1-1.x86_64.rpm                                    |  24 MB  00:01:31     
-----------------------------------------------------------------------------------------------------------
Total                                                                      329 kB/s |  29 MB  00:01:31     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:perl-Error-0.17020-2.el7.noarch                                                       1/6 
  Installing : rsync-3.1.2-10.el7.x86_64                                                               2/6 
  Installing : perl-TermReadKey-2.30-20.el7.x86_64                                                     3/6 
  Installing : perl-Git-1.8.3.1-23.el7_8.noarch                                                        4/6 
  Installing : git-1.8.3.1-23.el7_8.x86_64                                                             5/6 
  Installing : gitlab-ci-multi-runner-9.5.1-1.x86_64                                                   6/6 
GitLab Runner: creating gitlab-runner...
  Verifying  : git-1.8.3.1-23.el7_8.x86_64                                                             1/6 
  Verifying  : perl-TermReadKey-2.30-20.el7.x86_64                                                     2/6 
  Verifying  : 1:perl-Error-0.17020-2.el7.noarch                                                       3/6 
  Verifying  : rsync-3.1.2-10.el7.x86_64                                                               4/6 
  Verifying  : gitlab-ci-multi-runner-9.5.1-1.x86_64                                                   5/6 
  Verifying  : perl-Git-1.8.3.1-23.el7_8.noarch                                                        6/6 

Installed:
  gitlab-ci-multi-runner.x86_64 0:9.5.1-1                                                                  

Dependency Installed:
  git.x86_64 0:1.8.3.1-23.el7_8                      perl-Error.noarch 1:0.17020-2.el7                    
  perl-Git.noarch 0:1.8.3.1-23.el7_8                 perl-TermReadKey.x86_64 0:2.30-20.el7                
  rsync.x86_64 0:3.1.2-10.el7                       

Complete!
[root@yuyoho ~]# 

查看安装的版本

[root@yuyoho ~]# gitlab-runner -v
Version:      9.5.1
Git revision: 96b34cc
Git branch:   9-5-stable
GO version:   go1.8.3
Built:        Wed, 04 Oct 2017 16:26:27 +0000
OS/Arch:      linux/amd64
[root@yuyoho ~]# 

  

接下来,咱们就开始注册

[root@yuyoho ~]# gitlab-runner register
Running in system-mode.                            
                                                   
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://192.168.1.4/
Please enter the gitlab-ci token for this runner:
FpAyfGhaxsqySVxSs9kF
Please enter the gitlab-ci description for this runner:
[yuyoho]: 
Please enter the gitlab-ci tags for this runner (comma separated):

Whether to lock Runner to current project [true/false]:
[false]: true
Registering runner... succeeded                     runner=FpAyfGha                
Please enter the executor: docker-ssh, shell, docker-ssh+machine, docker, parallels, ssh, virtualbox, docker+machine, kubernetes:
[hell]: shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 
[root@yuyoho ~]# 

  

注册成功之后,咱们就能在Runner里面查看到已经运行的Runner

到此,咱们就已经在服务器上安装好了Gitlab-CI 以及运行了一个可用的Runner(工人|打工者)  

原文地址:https://www.cnblogs.com/yuyoho/p/13274533.html