centOS6.9 gitlab + gitlab-runner 集成 CICD

赫连永怡
2023-12-01

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

[root@insurance ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
--2020-07-15 16:43:28--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 359519811 (343M) [application/x-redhat-package-manager]
Saving to: “gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm”

100%[====================================================================================================================================================================================================================================>] 359,519,811 9.35M/s   in 37s     

2020-07-15 16:44:07 (9.19 MB/s) - “gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm” saved [359519811/359519811]

[root@insurance ~]# 

安装gitlab 安装命令:rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

[root@insurance ~]# rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
	policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64

出现个小插曲,缺少依赖 policycoreutils-python

安装policycoreutils-python依赖

[root@insurance ~]# yum install policycoreutils-python
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
base                                                                                                                                                                                                                                                   | 3.7 kB     00:00     
epel                                                                                                                                                                                                                                                   | 4.7 kB     00:00     
epel/primary_db                                                                                                                                                                                                                                        | 6.1 MB     00:00     
extras                                                                                                                                                                                                                                                 | 3.4 kB     00:00     
updates                                                                                                                                                                                                                                                | 3.4 kB     00:00     
updates/primary_db                                                                                                                                                                                                                                     |  10 MB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.0.83-30.1.el6_8 will be installed
--> Processing Dependency: libsemanage-python >= 2.0.43-4 for package: policycoreutils-python-2.0.83-30.1.el6_8.x86_64
--> Processing Dependency: audit-libs-python >= 1.4.2-1 for package: policycoreutils-。。。。                                                                                                                                                                                                                     
。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。很长。。。。。。。。。。
Dependency Installed:
  audit-libs-python.x86_64 0:2.4.5-6.el6      libcgroup.x86_64 0:0.40.rc1-27.el6_10      libselinux-python.x86_64 0:2.0.94-7.el6      libsemanage-python.x86_64 0:2.0.43-5.1.el6      setools-libs.x86_64 0:3.3.7-4.el6      setools-libs-python.x86_64 0:3.3.7-4.el6     

Complete!

 

继续安装,安装过程需要些时间,如果出现下图

[root@insurance ~]# rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
/opt/gitlab/embedded/bin/ruby: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/gitlab/embedded/lib/libruby.so.2.3)
/opt/gitlab/embedded/bin/ruby: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/gitlab/embedded/lib/libruby.so.2.3)
warning: %posttrans(gitlab-ce-10.0.0-ce.0.el7.x86_64) scriptlet failed, exit status 1

出现这个错误 就是说明 你当前安装的gitlab版本 与 系统版本不一致。

centOS 6.x版本服务器要下el/6,centOS 7则是el/6 ,我的服务器是centOS 6.9. 重新下载安装文件吧

[root@insurance ~]# cat /etc/issue
CentOS release 6.9 (Final)
Kernel \r on an \m

[root@insurance ~]# 

重新下载

[root@insurance ~]# wget https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-9.1.3-ce.0.el6.x86_64.rpm
--2020-07-15 16:59:30--  https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-9.1.3-ce.0.el6.x86_64.rpm
Resolving mirror.tuna.tsinghua.edu.cn... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirror.tuna.tsinghua.edu.cn|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 294666106 (281M) [application/x-redhat-package-manager]
Saving to: “gitlab-ce-9.1.3-ce.0.el6.x86_64.rpm”

安装

[root@insurance ~]# rpm -ivh gitlab-ce-9.1.3-ce.0.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:gitlab-ce              ########################################### [100%]


       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://gitlab.example.com
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab: 
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab: 
It looks like GitLab has not been configured yet; skipping the upgrade script.

注意:此处如果不是gitlab: GitLab should be reachable at http://gitlab.example.com这句的话,可能会在初始化时有问题,可以修改/etc/gitlab/gitlab.rb文件,改成external_url 'http://gitlab.example.com'然后在进行初始化

初始化gitlab

[root@insurance ~]# gitlab-ctl reconfigure
[root@insurance ~]# 

查看版本

[root@insurance ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION 
9.1.3

 

 类似资料: