本文展示如何在CentOS7上部署Gitlab代码托管应用。

关于GitLab,官方网站提供了安装的文档:
社区版:
https://www.gitlab.cc/downloads/#centos7

企业版:
https://www.gitlab.cc/downloads-ee/#centos7

本文,记录的是我在自己的环境中的尝试与实践。
——————————————————————

前提:
开始本文前,你需要有一个安装好的Linux操作系统。

目前,GitLab支持的系统列表如下:
gitlab_1

启用YUM缓存:

[root@center-linux ~]# cat /etc/yum.conf | grep --color keepcache
keepcache=0
[root@center-linux ~]# 
[root@center-linux ~]# sed -i '/keepcache/s/0/1/g' /etc/yum.conf 
[root@center-linux ~]# 
[root@center-linux ~]# cat /etc/yum.conf | grep --color keepcache
keepcache=1
[root@center-linux ~]# 

当前的YUM的源库:

[root@center-linux ~]# ls -ltr /etc/yum.repos.d/
total 24
-rw-r--r--. 1 root root 1002 Apr  1  2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 1331 Apr  1  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root  290 Apr  1  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  649 Apr  1  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1309 Apr  1  2015 CentOS-CR.repo
-rw-r--r--. 1 root root 1664 Apr  1  2015 CentOS-Base.repo
[root@center-linux ~]# 

安装依赖的软件包:
yum install -y curl openssh-server postfix

[root@center-linux ~]# yum install -y curl openssh-server
Loaded plugins: fastestmirror, langpacks
base                                                                                | 3.6 kB  00:00:00     
extras                                                                              | 3.4 kB  00:00:00     
updates                                                                             | 3.4 kB  00:00:00     
(1/2): base/7/x86_64/group_gz                                                       | 155 kB  00:00:00     
(2/2): base/7/x86_64/primary_db                                                     | 5.6 MB  00:00:21     
Determining fastest mirrors
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.29.0-19.el7 will be updated
---> Package curl.x86_64 0:7.29.0-35.el7.centos will be an update
--> Processing Dependency: libcurl = 7.29.0-35.el7.centos for package: curl-7.29.0-35.el7.centos.x86_64
---> Package openssh-server.x86_64 0:6.6.1p1-11.el7 will be updated
---> Package openssh-server.x86_64 0:6.6.1p1-31.el7 will be an update
--> Processing Dependency: openssh = 6.6.1p1-31.el7 for package: openssh-server-6.6.1p1-31.el7.x86_64
--> Running transaction check
---> Package libcurl.x86_64 0:7.29.0-19.el7 will be updated
---> Package libcurl.x86_64 0:7.29.0-35.el7.centos will be an update
---> Package openssh.x86_64 0:6.6.1p1-11.el7 will be updated
--> Processing Dependency: openssh = 6.6.1p1-11.el7 for package: openssh-clients-6.6.1p1-11.el7.x86_64
---> Package openssh.x86_64 0:6.6.1p1-31.el7 will be an update
--> Running transaction check
---> Package openssh-clients.x86_64 0:6.6.1p1-11.el7 will be updated
---> Package openssh-clients.x86_64 0:6.6.1p1-31.el7 will be an update
--> Processing Conflict: openssh-6.6.1p1-31.el7.x86_64 conflicts selinux-policy < 3.13.1-92
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package selinux-policy.noarch 0:3.13.1-23.el7 will be updated
--> Processing Dependency: selinux-policy = 3.13.1-23.el7 for package: selinux-policy-targeted-3.13.1-23.el7.noarch
--> Processing Dependency: selinux-policy = 3.13.1-23.el7 for package: selinux-policy-targeted-3.13.1-23.el7.noarch
---> Package selinux-policy.noarch 0:3.13.1-102.el7_3.7 will be an update
--> Processing Dependency: policycoreutils >= 2.5 for package: selinux-policy-3.13.1-102.el7_3.7.noarch
--> Processing Dependency: libsemanage >= 2.5 for package: selinux-policy-3.13.1-102.el7_3.7.noarch
--> Running transaction check
---> Package libsemanage.x86_64 0:2.1.10-16.el7 will be updated
--> Processing Dependency: libsemanage = 2.1.10-16.el7 for package: libsemanage-python-2.1.10-16.el7.x86_64
---> Package libsemanage.x86_64 0:2.5-4.el7 will be an update
--> Processing Dependency: libsepol.so.1(LIBSEPOL_1.1)(64bit) for package: libsemanage-2.5-4.el7.x86_64
--> Processing Dependency: libsepol.so.1(LIBSEPOL_1.0)(64bit) for package: libsemanage-2.5-4.el7.x86_64
---> Package policycoreutils.x86_64 0:2.2.5-15.el7 will be updated
--> Processing Dependency: policycoreutils = 2.2.5-15.el7 for package: policycoreutils-python-2.2.5-15.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-9.el7 will be an update
--> Processing Dependency: libselinux-utils >= 2.5-6 for package: policycoreutils-2.5-9.el7.x86_64
---> Package selinux-policy-targeted.noarch 0:3.13.1-23.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.7 will be an update
--> Running transaction check
---> Package libselinux-utils.x86_64 0:2.2.2-6.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-6.el7 will be an update
--> Processing Dependency: libselinux(x86-64) = 2.5-6.el7 for package: libselinux-utils-2.5-6.el7.x86_64
---> Package libsemanage-python.x86_64 0:2.1.10-16.el7 will be updated
---> Package libsemanage-python.x86_64 0:2.5-4.el7 will be an update
---> Package libsepol.x86_64 0:2.1.9-3.el7 will be updated
---> Package libsepol.x86_64 0:2.5-6.el7 will be an update
---> Package policycoreutils-python.x86_64 0:2.2.5-15.el7 will be updated
---> Package policycoreutils-python.x86_64 0:2.5-9.el7 will be an update
--> Processing Dependency: setools-libs >= 3.3.8-1 for package: policycoreutils-python-2.5-9.el7.x86_64
--> Running transaction check
---> Package libselinux.x86_64 0:2.2.2-6.el7 will be updated
--> Processing Dependency: libselinux = 2.2.2-6.el7 for package: libselinux-python-2.2.2-6.el7.x86_64
---> Package libselinux.x86_64 0:2.5-6.el7 will be an update
---> Package setools-libs.x86_64 0:3.3.7-46.el7 will be updated
---> Package setools-libs.x86_64 0:3.3.8-1.1.el7 will be an update
--> Running transaction check
---> Package libselinux-python.x86_64 0:2.2.2-6.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-6.el7 will be an update
--> Processing Conflict: libselinux-2.5-6.el7.x86_64 conflicts systemd < 219-20
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package systemd.x86_64 0:208-20.el7 will be updated
--> Processing Dependency: systemd = 208-20.el7 for package: systemd-sysv-208-20.el7.x86_64
--> Processing Dependency: systemd = 208-20.el7 for package: systemd-python-208-20.el7.x86_64
--> Processing Dependency: systemd = 208-20.el7 for package: libgudev1-208-20.el7.x86_64
---> Package systemd.x86_64 0:219-30.el7_3.6 will be an update
--> Processing Dependency: systemd-libs = 219-30.el7_3.6 for package: systemd-219-30.el7_3.6.x86_64
--> Processing Dependency: kmod >= 18-4 for package: systemd-219-30.el7_3.6.x86_64
--> Running transaction check
---> Package kmod.x86_64 0:14-10.el7 will be updated
---> Package kmod.x86_64 0:20-9.el7 will be an update
---> Package libgudev1.x86_64 0:208-20.el7 will be updated
---> Package libgudev1.x86_64 0:219-30.el7_3.6 will be an update
--> Processing Dependency: glib2 >= 2.42 for package: libgudev1-219-30.el7_3.6.x86_64
---> Package systemd-libs.x86_64 0:208-20.el7 will be updated
---> Package systemd-libs.x86_64 0:219-30.el7_3.6 will be an update
---> Package systemd-python.x86_64 0:208-20.el7 will be updated
---> Package systemd-python.x86_64 0:219-30.el7_3.6 will be an update
---> Package systemd-sysv.x86_64 0:208-20.el7 will be updated
---> Package systemd-sysv.x86_64 0:219-30.el7_3.6 will be an update
--> Running transaction check
---> Package glib2.x86_64 0:2.40.0-4.el7 will be updated
---> Package glib2.x86_64 0:2.46.2-4.el7 will be an update
--> Processing Conflict: systemd-219-30.el7_3.6.x86_64 conflicts initscripts < 9.49.28-1
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package initscripts.x86_64 0:9.49.24-1.el7 will be updated
---> Package initscripts.x86_64 0:9.49.37-1.el7 will be an update
--> Processing Conflict: systemd-219-30.el7_3.6.x86_64 conflicts dracut < 033-243
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package dracut.x86_64 0:033-240.el7 will be updated
--> Processing Dependency: dracut = 033-240.el7 for package: dracut-config-rescue-033-240.el7.x86_64
--> Processing Dependency: dracut = 033-240.el7 for package: dracut-network-033-240.el7.x86_64
---> Package dracut.x86_64 0:033-463.el7 will be an update
--> Running transaction check
---> Package dracut-config-rescue.x86_64 0:033-240.el7 will be updated
---> Package dracut-config-rescue.x86_64 0:033-463.el7 will be an update
---> Package dracut-network.x86_64 0:033-240.el7 will be updated
---> Package dracut-network.x86_64 0:033-463.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package                           Arch             Version                        Repository         Size
===========================================================================================================
Updating:
 curl                              x86_64           7.29.0-35.el7.centos           base              265 k
 dracut                            x86_64           033-463.el7                    base              317 k
 initscripts                       x86_64           9.49.37-1.el7                  base              431 k
 openssh-server                    x86_64           6.6.1p1-31.el7                 base              439 k
 selinux-policy                    noarch           3.13.1-102.el7_3.7             updates           412 k
 systemd                           x86_64           219-30.el7_3.6                 updates           5.2 M
Updating for dependencies:
 dracut-config-rescue              x86_64           033-463.el7                    base               54 k
 dracut-network                    x86_64           033-463.el7                    base               96 k
 glib2                             x86_64           2.46.2-4.el7                   base              2.3 M
 kmod                              x86_64           20-9.el7                       base              115 k
 libcurl                           x86_64           7.29.0-35.el7.centos           base              218 k
 libgudev1                         x86_64           219-30.el7_3.6                 updates            76 k
 libselinux                        x86_64           2.5-6.el7                      base              161 k
 libselinux-python                 x86_64           2.5-6.el7                      base              234 k
 libselinux-utils                  x86_64           2.5-6.el7                      base              151 k
 libsemanage                       x86_64           2.5-4.el7                      base              144 k
 libsemanage-python                x86_64           2.5-4.el7                      base              103 k
 libsepol                          x86_64           2.5-6.el7                      base              288 k
 openssh                           x86_64           6.6.1p1-31.el7                 base              437 k
 openssh-clients                   x86_64           6.6.1p1-31.el7                 base              642 k
 policycoreutils                   x86_64           2.5-9.el7                      updates           841 k
 policycoreutils-python            x86_64           2.5-9.el7                      updates           444 k
 selinux-policy-targeted           noarch           3.13.1-102.el7_3.7             updates           6.4 M
 setools-libs                      x86_64           3.3.8-1.1.el7                  base              612 k
 systemd-libs                      x86_64           219-30.el7_3.6                 updates           368 k
 systemd-python                    x86_64           219-30.el7_3.6                 updates           109 k
 systemd-sysv                      x86_64           219-30.el7_3.6                 updates            63 k

Transaction Summary
===========================================================================================================
Upgrade  6 Packages (+21 Dependent packages)

Total download size: 21 M
Downloading packages:
No Presto metadata available for base
warning: /var/cache/yum/x86_64/7/base/packages/dracut-network-033-463.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for dracut-network-033-463.el7.x86_64.rpm is not installed
(1/27): dracut-network-033-463.el7.x86_64.rpm                                       |  96 kB  00:00:00     
(2/27): dracut-config-rescue-033-463.el7.x86_64.rpm                                 |  54 kB  00:00:00     
(3/27): initscripts-9.49.37-1.el7.x86_64.rpm                                        | 431 kB  00:00:00     
(4/27): libcurl-7.29.0-35.el7.centos.x86_64.rpm                                     | 218 kB  00:00:00     
(5/27): dracut-033-463.el7.x86_64.rpm                                               | 317 kB  00:00:00     
(6/27): kmod-20-9.el7.x86_64.rpm                                                    | 115 kB  00:00:00     
(7/27): curl-7.29.0-35.el7.centos.x86_64.rpm                                        | 265 kB  00:00:00     
(8/27): libselinux-utils-2.5-6.el7.x86_64.rpm                                       | 151 kB  00:00:00     
(9/27): libselinux-2.5-6.el7.x86_64.rpm                                             | 161 kB  00:00:00     
(10/27): libsemanage-python-2.5-4.el7.x86_64.rpm                                    | 103 kB  00:00:00     
(11/27): libselinux-python-2.5-6.el7.x86_64.rpm                                     | 234 kB  00:00:00     
(12/27): libsemanage-2.5-4.el7.x86_64.rpm                                           | 144 kB  00:00:00     
Public key for libgudev1-219-30.el7_3.6.x86_64.rpm is not installed
(13/27): libgudev1-219-30.el7_3.6.x86_64.rpm                                        |  76 kB  00:00:00     
(14/27): libsepol-2.5-6.el7.x86_64.rpm                                              | 288 kB  00:00:00     
(15/27): openssh-server-6.6.1p1-31.el7.x86_64.rpm                                   | 439 kB  00:00:00     
(16/27): openssh-6.6.1p1-31.el7.x86_64.rpm                                          | 437 kB  00:00:00     
(17/27): openssh-clients-6.6.1p1-31.el7.x86_64.rpm                                  | 642 kB  00:00:00     
(18/27): policycoreutils-2.5-9.el7.x86_64.rpm                                       | 841 kB  00:00:00     
(19/27): policycoreutils-python-2.5-9.el7.x86_64.rpm                                | 444 kB  00:00:00     
(20/27): selinux-policy-3.13.1-102.el7_3.7.noarch.rpm                               | 412 kB  00:00:00     
(21/27): setools-libs-3.3.8-1.1.el7.x86_64.rpm                                      | 612 kB  00:00:00     
(22/27): systemd-python-219-30.el7_3.6.x86_64.rpm                                   | 109 kB  00:00:00     
(23/27): systemd-sysv-219-30.el7_3.6.x86_64.rpm                                     |  63 kB  00:00:00     
(24/27): systemd-libs-219-30.el7_3.6.x86_64.rpm                                     | 368 kB  00:00:00     
(25/27): selinux-policy-targeted-3.13.1-102.el7_3.7.noarch.rpm                      | 6.4 MB  00:00:01     
(26/27): systemd-219-30.el7_3.6.x86_64.rpm                                          | 5.2 MB  00:00:02     
(27/27): glib2-2.46.2-4.el7.x86_64.rpm                                              | 2.3 MB  00:00:04     
-----------------------------------------------------------------------------------------------------------
Total                                                                      4.2 MB/s |  21 MB  00:00:04     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) "
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-1.1503.el7.centos.2.8.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libsepol-2.5-6.el7.x86_64                                                              1/54 
  Updating   : libselinux-2.5-6.el7.x86_64                                                            2/54 
  Updating   : systemd-libs-219-30.el7_3.6.x86_64                                                     3/54 
  Updating   : libsemanage-2.5-4.el7.x86_64                                                           4/54 
  Updating   : glib2-2.46.2-4.el7.x86_64                                                              5/54 
  Updating   : openssh-6.6.1p1-31.el7.x86_64                                                          6/54 
  Updating   : libcurl-7.29.0-35.el7.centos.x86_64                                                    7/54 
  Updating   : kmod-20-9.el7.x86_64                                                                   8/54 
  Updating   : systemd-219-30.el7_3.6.x86_64                                                          9/54 
  Updating   : dracut-033-463.el7.x86_64                                                             10/54 
  Updating   : libsemanage-python-2.5-4.el7.x86_64                                                   11/54 
  Updating   : libselinux-python-2.5-6.el7.x86_64                                                    12/54 
  Updating   : libselinux-utils-2.5-6.el7.x86_64                                                     13/54 
  Updating   : policycoreutils-2.5-9.el7.x86_64                                                      14/54 
  Updating   : selinux-policy-3.13.1-102.el7_3.7.noarch                                              15/54 
  Updating   : setools-libs-3.3.8-1.1.el7.x86_64                                                     16/54 
  Updating   : policycoreutils-python-2.5-9.el7.x86_64                                               17/54 
  Updating   : selinux-policy-targeted-3.13.1-102.el7_3.7.noarch                                     18/54 
  Updating   : dracut-config-rescue-033-463.el7.x86_64                                               19/54 
  Updating   : dracut-network-033-463.el7.x86_64                                                     20/54 
  Updating   : initscripts-9.49.37-1.el7.x86_64                                                      21/54 
  Updating   : systemd-python-219-30.el7_3.6.x86_64                                                  22/54 
  Updating   : openssh-server-6.6.1p1-31.el7.x86_64                                                  23/54 
  Updating   : systemd-sysv-219-30.el7_3.6.x86_64                                                    24/54 
  Updating   : curl-7.29.0-35.el7.centos.x86_64                                                      25/54 
  Updating   : openssh-clients-6.6.1p1-31.el7.x86_64                                                 26/54 
  Updating   : libgudev1-219-30.el7_3.6.x86_64                                                       27/54 
  Cleanup    : policycoreutils-python-2.2.5-15.el7.x86_64                                            28/54 
  Cleanup    : libgudev1-208-20.el7.x86_64                                                           29/54 
  Cleanup    : openssh-server-6.6.1p1-11.el7.x86_64                                                  30/54 
  Cleanup    : systemd-python-208-20.el7.x86_64                                                      31/54 
  Cleanup    : initscripts-9.49.24-1.el7.x86_64                                                      32/54 
  Cleanup    : selinux-policy-targeted-3.13.1-23.el7.noarch                                          33/54 
  Cleanup    : selinux-policy-3.13.1-23.el7.noarch                                                   34/54 
  Cleanup    : dracut-network-033-240.el7.x86_64                                                     35/54 
  Cleanup    : dracut-config-rescue-033-240.el7.x86_64                                               36/54 
  Cleanup    : systemd-sysv-208-20.el7.x86_64                                                        37/54 
  Cleanup    : policycoreutils-2.2.5-15.el7.x86_64                                                   38/54 
  Cleanup    : dracut-033-240.el7.x86_64                                                             39/54 
  Cleanup    : systemd-208-20.el7.x86_64                                                             40/54 
  Cleanup    : setools-libs-3.3.7-46.el7.x86_64                                                      41/54 
  Cleanup    : openssh-clients-6.6.1p1-11.el7.x86_64                                                 42/54 
  Cleanup    : openssh-6.6.1p1-11.el7.x86_64                                                         43/54 
  Cleanup    : systemd-libs-208-20.el7.x86_64                                                        44/54 
  Cleanup    : libselinux-utils-2.2.2-6.el7.x86_64                                                   45/54 
  Cleanup    : glib2-2.40.0-4.el7.x86_64                                                             46/54 
  Cleanup    : libselinux-python-2.2.2-6.el7.x86_64                                                  47/54 
  Cleanup    : libsemanage-python-2.1.10-16.el7.x86_64                                               48/54 
  Cleanup    : libsemanage-2.1.10-16.el7.x86_64                                                      49/54 
  Cleanup    : libselinux-2.2.2-6.el7.x86_64                                                         50/54 
  Cleanup    : curl-7.29.0-19.el7.x86_64                                                             51/54 
  Cleanup    : libcurl-7.29.0-19.el7.x86_64                                                          52/54 
  Cleanup    : libsepol-2.1.9-3.el7.x86_64                                                           53/54 
  Cleanup    : kmod-14-10.el7.x86_64                                                                 54/54 
  Verifying  : libsepol-2.5-6.el7.x86_64                                                              1/54 
  Verifying  : initscripts-9.49.37-1.el7.x86_64                                                       2/54 
  Verifying  : selinux-policy-3.13.1-102.el7_3.7.noarch                                               3/54 
  Verifying  : libselinux-python-2.5-6.el7.x86_64                                                     4/54 
  Verifying  : systemd-libs-219-30.el7_3.6.x86_64                                                     5/54 
  Verifying  : libselinux-utils-2.5-6.el7.x86_64                                                      6/54 
  Verifying  : libsemanage-python-2.5-4.el7.x86_64                                                    7/54 
  Verifying  : systemd-python-219-30.el7_3.6.x86_64                                                   8/54 
  Verifying  : kmod-20-9.el7.x86_64                                                                   9/54 
  Verifying  : dracut-033-463.el7.x86_64                                                             10/54 
  Verifying  : openssh-server-6.6.1p1-31.el7.x86_64                                                  11/54 
  Verifying  : policycoreutils-2.5-9.el7.x86_64                                                      12/54 
  Verifying  : systemd-sysv-219-30.el7_3.6.x86_64                                                    13/54 
  Verifying  : dracut-config-rescue-033-463.el7.x86_64                                               14/54 
  Verifying  : dracut-network-033-463.el7.x86_64                                                     15/54 
  Verifying  : selinux-policy-targeted-3.13.1-102.el7_3.7.noarch                                     16/54 
  Verifying  : libcurl-7.29.0-35.el7.centos.x86_64                                                   17/54 
  Verifying  : libselinux-2.5-6.el7.x86_64                                                           18/54 
  Verifying  : glib2-2.46.2-4.el7.x86_64                                                             19/54 
  Verifying  : curl-7.29.0-35.el7.centos.x86_64                                                      20/54 
  Verifying  : libgudev1-219-30.el7_3.6.x86_64                                                       21/54 
  Verifying  : systemd-219-30.el7_3.6.x86_64                                                         22/54 
  Verifying  : policycoreutils-python-2.5-9.el7.x86_64                                               23/54 
  Verifying  : openssh-6.6.1p1-31.el7.x86_64                                                         24/54 
  Verifying  : openssh-clients-6.6.1p1-31.el7.x86_64                                                 25/54 
  Verifying  : libsemanage-2.5-4.el7.x86_64                                                          26/54 
  Verifying  : setools-libs-3.3.8-1.1.el7.x86_64                                                     27/54 
  Verifying  : openssh-server-6.6.1p1-11.el7.x86_64                                                  28/54 
  Verifying  : dracut-network-033-240.el7.x86_64                                                     29/54 
  Verifying  : kmod-14-10.el7.x86_64                                                                 30/54 
  Verifying  : setools-libs-3.3.7-46.el7.x86_64                                                      31/54 
  Verifying  : dracut-033-240.el7.x86_64                                                             32/54 
  Verifying  : initscripts-9.49.24-1.el7.x86_64                                                      33/54 
  Verifying  : selinux-policy-targeted-3.13.1-23.el7.noarch                                          34/54 
  Verifying  : policycoreutils-2.2.5-15.el7.x86_64                                                   35/54 
  Verifying  : libgudev1-208-20.el7.x86_64                                                           36/54 
  Verifying  : dracut-config-rescue-033-240.el7.x86_64                                               37/54 
  Verifying  : libselinux-utils-2.2.2-6.el7.x86_64                                                   38/54 
  Verifying  : glib2-2.40.0-4.el7.x86_64                                                             39/54 
  Verifying  : systemd-208-20.el7.x86_64                                                             40/54 
  Verifying  : selinux-policy-3.13.1-23.el7.noarch                                                   41/54 
  Verifying  : curl-7.29.0-19.el7.x86_64                                                             42/54 
  Verifying  : libsemanage-2.1.10-16.el7.x86_64                                                      43/54 
  Verifying  : libsepol-2.1.9-3.el7.x86_64                                                           44/54 
  Verifying  : systemd-libs-208-20.el7.x86_64                                                        45/54 
  Verifying  : openssh-6.6.1p1-11.el7.x86_64                                                         46/54 
  Verifying  : systemd-sysv-208-20.el7.x86_64                                                        47/54 
  Verifying  : libselinux-python-2.2.2-6.el7.x86_64                                                  48/54 
  Verifying  : policycoreutils-python-2.2.5-15.el7.x86_64                                            49/54 
  Verifying  : libsemanage-python-2.1.10-16.el7.x86_64                                               50/54 
  Verifying  : systemd-python-208-20.el7.x86_64                                                      51/54 
  Verifying  : openssh-clients-6.6.1p1-11.el7.x86_64                                                 52/54 
  Verifying  : libselinux-2.2.2-6.el7.x86_64                                                         53/54 
  Verifying  : libcurl-7.29.0-19.el7.x86_64                                                          54/54 

Updated:
  curl.x86_64 0:7.29.0-35.el7.centos                     dracut.x86_64 0:033-463.el7                       
  initscripts.x86_64 0:9.49.37-1.el7                     openssh-server.x86_64 0:6.6.1p1-31.el7            
  selinux-policy.noarch 0:3.13.1-102.el7_3.7             systemd.x86_64 0:219-30.el7_3.6                   

Dependency Updated:
  dracut-config-rescue.x86_64 0:033-463.el7                 dracut-network.x86_64 0:033-463.el7            
  glib2.x86_64 0:2.46.2-4.el7                               kmod.x86_64 0:20-9.el7                         
  libcurl.x86_64 0:7.29.0-35.el7.centos                     libgudev1.x86_64 0:219-30.el7_3.6              
  libselinux.x86_64 0:2.5-6.el7                             libselinux-python.x86_64 0:2.5-6.el7           
  libselinux-utils.x86_64 0:2.5-6.el7                       libsemanage.x86_64 0:2.5-4.el7                 
  libsemanage-python.x86_64 0:2.5-4.el7                     libsepol.x86_64 0:2.5-6.el7                    
  openssh.x86_64 0:6.6.1p1-31.el7                           openssh-clients.x86_64 0:6.6.1p1-31.el7        
  policycoreutils.x86_64 0:2.5-9.el7                        policycoreutils-python.x86_64 0:2.5-9.el7      
  selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.7       setools-libs.x86_64 0:3.3.8-1.1.el7            
  systemd-libs.x86_64 0:219-30.el7_3.6                      systemd-python.x86_64 0:219-30.el7_3.6         
  systemd-sysv.x86_64 0:219-30.el7_3.6                     

Complete!
[root@center-linux ~]# 

[root@center-linux ~]# yum install -y postfix
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
Package 2:postfix-2.10.1-6.el7.x86_64 already installed and latest version
Nothing to do
[root@center-linux ~]# 

设置启动项、开启服务,并加入防火墙策略:

[root@center-linux ~]# systemctl enable sshd
[root@center-linux ~]# systemctl enable postfix
[root@center-linux ~]# 
[root@center-linux ~]# systemctl start sshd
[root@center-linux ~]# systemctl start postfix
[root@center-linux ~]# 
[root@center-linux ~]# firewall-cmd --permanent --add-service=http
success
[root@center-linux ~]# 
[root@center-linux ~]# systemctl reload firewalld
[root@center-linux ~]# 
[root@center-linux ~]# firewall-cmd --list-all
public (default, active)
  interfaces: eno16777728
  sources: 
  services: dhcpv6-client http ssh
  ports: 
  masquerade: no
  forward-ports: 
  icmp-blocks: 
  rich rules: 

[root@center-linux ~]# 

添加GitLab仓库:
这里的仓库的获取,可以体现出社区版与企业版的差异:

社区版:
curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash

企业版:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

可以看到,一个是:gitlab-ce,另一个是:gitlab-ee。

GitLab EE的安装过程

[root@center-linux script]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6371    0  6371    0     0    511      0 --:--:--  0:00:12 --:--:--  1617
Detected operating system as centos/7.
Checking for curl...
Detected curl...
Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/config_file.repo?os=centos&dist=7&source=script
done.
Installing pygpgme to verify GPG signatures...
Loaded plugins: fastestmirror, langpacks
gitlab-ce                                                                           | 2.9 kB  00:00:00     
gitlab_gitlab-ee-source/signature                                                   |  836 B  00:00:00     
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
Importing GPG key 0xE15E78F4:
 Userid     : "GitLab B.V. (package repository signing key) "
 Fingerprint: 1a4c 919d b987 d435 9396 38b9 1421 9a96 e15e 78f4
 From       : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
gitlab_gitlab-ee-source/signature                                                   |  951 B  00:00:00 !!! 
gitlab-ce/primary_db                                                                | 1.1 MB  00:00:00     
gitlab_gitlab-ee-source/primary                                                     |  175 B  00:00:02     
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
Package pygpgme-0.3-9.el7.x86_64 already installed and latest version
Nothing to do
Installing yum-utils...
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-29.el7 will be updated
---> Package yum-utils.noarch 0:1.1.31-40.el7 will be an update
--> Processing Dependency: yum >= 3.4.3-143 for package: yum-utils-1.1.31-40.el7.noarch
--> Running transaction check
---> Package yum.noarch 0:3.4.3-125.el7.centos will be updated
---> Package yum.noarch 0:3.4.3-150.el7.centos will be an update
--> Processing Dependency: python-urlgrabber >= 3.10-8 for package: yum-3.4.3-150.el7.centos.noarch
--> Running transaction check
---> Package python-urlgrabber.noarch 0:3.10-6.el7 will be updated
---> Package python-urlgrabber.noarch 0:3.10-8.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package                       Arch               Version                           Repository        Size
===========================================================================================================
Updating:
 yum-utils                     noarch             1.1.31-40.el7                     base             116 k
Updating for dependencies:
 python-urlgrabber             noarch             3.10-8.el7                        base             108 k
 yum                           noarch             3.4.3-150.el7.centos              base             1.2 M

Transaction Summary
===========================================================================================================
Upgrade  1 Package (+2 Dependent packages)

Total download size: 1.4 M
Downloading packages:
No Presto metadata available for base
(1/3): python-urlgrabber-3.10-8.el7.noarch.rpm                                      | 108 kB  00:00:00     
(2/3): yum-utils-1.1.31-40.el7.noarch.rpm                                           | 116 kB  00:00:00     
(3/3): yum-3.4.3-150.el7.centos.noarch.rpm                                          | 1.2 MB  00:00:00     
-----------------------------------------------------------------------------------------------------------
Total                                                                      3.5 MB/s | 1.4 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : python-urlgrabber-3.10-8.el7.noarch                                                     1/6 
  Updating   : yum-3.4.3-150.el7.centos.noarch                                                         2/6 
  Updating   : yum-utils-1.1.31-40.el7.noarch                                                          3/6 
  Cleanup    : yum-utils-1.1.31-29.el7.noarch                                                          4/6 
  Cleanup    : yum-3.4.3-125.el7.centos.noarch                                                         5/6 
  Cleanup    : python-urlgrabber-3.10-6.el7.noarch                                                     6/6 
  Verifying  : yum-utils-1.1.31-40.el7.noarch                                                          1/6 
  Verifying  : yum-3.4.3-150.el7.centos.noarch                                                         2/6 
  Verifying  : python-urlgrabber-3.10-8.el7.noarch                                                     3/6 
  Verifying  : yum-3.4.3-125.el7.centos.noarch                                                         4/6 
  Verifying  : python-urlgrabber-3.10-6.el7.noarch                                                     5/6 
  Verifying  : yum-utils-1.1.31-29.el7.noarch                                                          6/6 

Updated:
  yum-utils.noarch 0:1.1.31-40.el7                                                                         

Dependency Updated:
  python-urlgrabber.noarch 0:3.10-8.el7                  yum.noarch 0:3.4.3-150.el7.centos                 

Complete!
Generating yum cache for gitlab_gitlab-ee...
Importing GPG key 0xE15E78F4:
 Userid     : "GitLab B.V. (package repository signing key) "
 Fingerprint: 1a4c 919d b987 d435 9396 38b9 1421 9a96 e15e 78f4
 From       : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey

(... ... 过多的输出)

Generating yum cache for gitlab_gitlab-ee...

The repository is setup! You can now install packages.
[root@center-linux script]# 

这一步完成后,YUM的源库会有所变化:

[root@center-linux script]# ls -ltr /etc/yum.repos.d/
total 32
-rw-r--r--. 1 root root 1002 Apr  1  2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 1331 Apr  1  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root  290 Apr  1  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  649 Apr  1  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1309 Apr  1  2015 CentOS-CR.repo
-rw-r--r--. 1 root root 1664 Apr  1  2015 CentOS-Base.repo
-rw-r--r--. 1 root root  571 Jan 11 10:59 gitlab_gitlab-ee.repo
-rw-r--r--. 1 root root  169 Jan 11 11:00 gitlab_gitlab-ce.repo
[root@center-linux script]# 

然后,要安装哪个版本,通过YUM就可以做到:
社区版:
yum install -y gitlab-ce

企业版:
yum install -y gitlab-ee

这里,我们装社区版:

[root@center-linux script]# yum install gitlab-ce
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package gitlab-ce.x86_64 0:8.15.3-ce.0.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================
 Package                   Arch                   Version                            Repository                 Size
=====================================================================================================================
Installing:
 gitlab-ce                 x86_64                 8.15.3-ce.0.el7                    gitlab-ce                 294 M

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

Total download size: 294 M
Installed size: 294 M
Is this ok [y/d/N]: y
Downloading packages:
gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm                                                          | 294 MB  00:00:40     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : gitlab-ce-8.15.3-ce.0.el7.x86_64                                                                  1/1 


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

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


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://center-linux
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: 

gitlab: GitLab now ships with a newer version of PostgreSQL (9.6.1), and will be used
gitlab: as the default in the next major relase. To upgrade, RUN THE FOLLOWING COMMANDS:

sudo gitlab-ctl pg-upgrade

gitlab: For more details, please see:
gitlab: https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server
gitlab: 
It looks like GitLab has not been configured yet; skipping the upgrade script.
  Verifying  : gitlab-ce-8.15.3-ce.0.el7.x86_64                                                                  1/1 

Installed:
  gitlab-ce.x86_64 0:8.15.3-ce.0.el7                                                                                 

Complete!
[root@center-linux script]# 

启动GitLab:

[root@center-linux script]# gitlab-ctl reconfigure

(... ... 过多的输出。)

Recipe: gitlab::nginx
  * ruby_block[reload nginx svlogd configuration] action create
    - execute the ruby block reload nginx svlogd configuration
Recipe: gitlab::logrotate
  * ruby_block[reload logrotate svlogd configuration] action create
    - execute the ruby block reload logrotate svlogd configuration

Running handlers:
Running handlers complete
Chef Client finished, 234/327 resources updated in 01 minutes 26 seconds
gitlab Reconfigured!
[root@center-linux script]# 

这样,GitLab,就装好了。

浏览器访问当前服务器:

[root@center-linux script]# ifconfig
eno16777728: flags=4163  mtu 1500
        inet 192.168.19.137  netmask 255.255.255.0  broadcast 192.168.19.255
        inet6 fe80::20c:29ff:fe2e:db31  prefixlen 64  scopeid 0x20
        ether 00:0c:29:2e:db:31  txqueuelen 1000  (Ethernet)
        RX packets 289023  bytes 429915252 (409.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 107292  bytes 7205810 (6.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 0  (Local Loopback)
        RX packets 267  bytes 170289 (166.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 267  bytes 170289 (166.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@center-linux script]# 

URL:http://192.168.19.137

第一次访问,会要求设置密码:
gitlab_2

然后,就可以登录了:
gitlab_3

gitlab_4

————————————————
至此,GitLab的部署完成。

————————————————
Done。

3
说点什么

avatar
3 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Adamhuan Recent comment authors

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒
trackback

[…] Gitlab:Install on CentOS 7 […]