Install GitLab CE on CentOS 8 - CentLinux

Latest

Thursday, 9 July 2020

Install GitLab CE on CentOS 8

Install GitLab CE on CentOS 8

In this lab, you will learn how to install GitLab CE (Community Edition) on CentOS 8 operating system.

 

Table of Contents:

     

    What is GitLab? :

    GitLab is web-based software for managing complete DevOps life cycle. GitLab provides a Git repository manager providing wiki, issue-tracking and continuous integration/continuous deployment (CI/CD) pipeline features.

    GitLab is developed by GitLab Inc and available in following two editions.

    • GitLab CE - Community Edition : It is open core edition of GitLab available under MIT License.
    •  

    • GitLab EE - Enterprise Edition: It is commercial edition of GitLab. GitLab EE is loaded with many advanced features as compare to GitLab EE, but you need to acquire a proprietary license to unlock these features. Although, you can use GitLab EE without a license but it will allow you only those features that are available in GitLab CE.

    GitLab was initially written in Ruby, but later on some parts were rewritten in Go language. The current technology stack include Go, Ruby on Rails and Vue.js.

     

    Environment Specification:

    We are using a minimal installed CentOS 8 virtual machine with following specification.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 2 GB
    • Storage - 40 GB
    • Operating System - CentOS 8.2
    • Hostname – gitlab-ce-01.centlinux.com
    • IP Address - 192.168.116.206 /24

     

    Update CentOS 8 Software Packages:

    Connect with gitlab-ce-01.centlinux.com as root user by using PuTTY.

    Update installed software packages by using dnf command.

    [root@gitlab-ce-01 ~]# dnf update -y Last metadata expiration check: 0:00:15 ago on Sun 05 Jul 2020 10:54:35 PM PKT. Dependencies resolved. ================================================================================ Package Arch Version Repo Size ================================================================================ Upgrading: gnutls x86_64 3.6.8-11.el8_2 BaseOS 915 k libnghttp2 x86_64 1.33.0-3.el8_2.1 BaseOS 77 k microcode_ctl x86_64 4:20191115-4.20200609.1.el8_2 BaseOS 2.7 M Transaction Summary ================================================================================ Upgrade 3 Packages Total download size: 3.7 M Downloading Packages: (1/3): libnghttp2-1.33.0-3.el8_2.1.x86_64.rpm 169 kB/s | 77 kB 00:00 (2/3): gnutls-3.6.8-11.el8_2.x86_64.rpm 584 kB/s | 915 kB 00:01 (3/3): microcode_ctl-20191115-4.20200609.1.el8_ 780 kB/s | 2.7 MB 00:03 -------------------------------------------------------------------------------- Total 524 kB/s | 3.7 MB 00:07 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 1/1 Upgrading : microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 1/6 Running scriptlet: microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 1/6 Upgrading : libnghttp2-1.33.0-3.el8_2.1.x86_64 2/6 Upgrading : gnutls-3.6.8-11.el8_2.x86_64 3/6 Running scriptlet: microcode_ctl-4:20191115-4.20200602.2.el8_2.x86_64 4/6 Cleanup : microcode_ctl-4:20191115-4.20200602.2.el8_2.x86_64 4/6 Running scriptlet: microcode_ctl-4:20191115-4.20200602.2.el8_2.x86_64 4/6 Cleanup : libnghttp2-1.33.0-1.el8_0.1.x86_64 5/6 Cleanup : gnutls-3.6.8-10.el8_2.x86_64 6/6 Running scriptlet: microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 6/6 Running scriptlet: gnutls-3.6.8-10.el8_2.x86_64 6/6 Verifying : gnutls-3.6.8-11.el8_2.x86_64 1/6 Verifying : gnutls-3.6.8-10.el8_2.x86_64 2/6 Verifying : libnghttp2-1.33.0-3.el8_2.1.x86_64 3/6 Verifying : libnghttp2-1.33.0-1.el8_0.1.x86_64 4/6 Verifying : microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 5/6 Verifying : microcode_ctl-4:20191115-4.20200602.2.el8_2.x86_64 6/6 Upgraded: gnutls-3.6.8-11.el8_2.x86_64 libnghttp2-1.33.0-3.el8_2.1.x86_64 microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 Complete!

    Verify the Linux kernel version.

    [root@gitlab-ce-01 ~]# uname -a Linux gitlab-ce-01.centlinux.com 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

    Verify the CentOS operating system version.

    [root@gitlab-ce-01 ~]# cat /etc/redhat-release CentOS Linux release 8.2.2004 (Core)

     

    Install GitLab CE Prerequisites on CentOS 8:

    GitLab CE requires some other software packages. Therefore, we are installing them by using the dnf command.

    [root@gitlab-ce-01 ~]# dnf install -y curl policycoreutils openssh-server Last metadata expiration check: 0:05:36 ago on Sun 05 Jul 2020 10:54:35 PM PKT. Package curl-7.61.1-12.el8.x86_64 is already installed. Package policycoreutils-2.9-9.el8.x86_64 is already installed. Package openssh-server-8.0p1-4.el8_1.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete!

    All three packages are already installed on our CentOS 8 server.

    GitLab CE requires a local SMTP server to send emails notifications. Therefore, we are installing Postfix on our GitLab CE server.

    [root@gitlab-ce-01 ~]# dnf install -y postfix Last metadata expiration check: 0:07:27 ago on Sun 05 Jul 2020 10:54:35 PM PKT. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: postfix x86_64 2:3.3.1-12.el8 BaseOS 1.4 M Transaction Summary ================================================================================ Install 1 Package Total download size: 1.4 M Installed size: 4.1 M Downloading Packages: postfix-3.3.1-12.el8.x86_64.rpm 1.0 MB/s | 1.4 MB 00:01 -------------------------------------------------------------------------------- Total 670 kB/s | 1.4 MB 00:02 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: postfix-2:3.3.1-12.el8.x86_64 1/1 Installing : postfix-2:3.3.1-12.el8.x86_64 1/1 Running scriptlet: postfix-2:3.3.1-12.el8.x86_64 1/1 Verifying : postfix-2:3.3.1-12.el8.x86_64 1/1 Installed: postfix-2:3.3.1-12.el8.x86_64 Complete!

    Start and enable Postfix service.

    [root@gitlab-ce-01 ~]# systemctl enable --now postfix.service Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service รข /usr/lib/systemd/system/postfix.service.

     

    Configure CentOS 8 Firewall:

    GitLab web application runs by default on port 80 and 443. Therefore, we are allowing the http and https services in Linux firewall.

    [root@gitlab-ce-01 ~]# firewall-cmd --permanent --add-service={http,https} success [root@gitlab-ce-01 ~]# firewall-cmd --reload success

     

    Install GitLab Yum Repository on CentOS 8:

    GitLab documentation provides a script to to install GitLab yum repository. We are executing that same command here.

    [root@gitlab-ce-01 ~]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 6856 100 6856 0 0 4683 0 0:00:01 0:00:01 --:--:-- 4683 Detected operating system as centos/8. Checking for curl... Detected curl... Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=centos&dist=8&source=script done. Installing yum-utils... gitlab_gitlab-ce-source 161 B/s | 862 B 00:05 gitlab_gitlab-ce-source 2.2 kB/s | 3.1 kB 00:01 Importing GPG key 0x51312F3F: Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>" Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey gitlab_gitlab-ce-source 2.2 kB/s | 3.9 kB 00:01 Importing GPG key 0xF27EAB47: Userid : "GitLab, Inc. <support@gitlab.com>" Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47 From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg gitlab_gitlab-ce-source 32 B/s | 296 B 00:09 Last metadata expiration check: 0:00:01 ago on Sun 05 Jul 2020 11:04:33 PM PKT. Package yum-utils-4.0.12-3.el8.noarch is already installed. Dependencies resolved. Nothing to do. Complete! Generating yum cache for gitlab_gitlab-ce... Importing GPG key 0x51312F3F: Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>" Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey Importing GPG key 0xF27EAB47: Userid : "GitLab, Inc. <support@gitlab.com>" Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47 From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg Generating yum cache for gitlab_gitlab-ce-source... The repository is setup! You can now install packages.

     

    Install GitLab CE on CentOS 8:

    Since, we have successfully installed GitLab yum repository on our CentOS 8 machine. Now, we can easily install GitLab CE by using dnf command.

    [root@gitlab-ce-01 ~]# dnf install -y gitlab-ce Last metadata expiration check: 0:00:41 ago on Sun 05 Jul 2020 11:04:55 PM PKT. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: gitlab-ce x86_64 13.1.2-ce.0.el8 gitlab_gitlab-ce 716 M Installing dependencies: checkpolicy x86_64 2.9-1.el8 BaseOS 348 k policycoreutils-python-utils noarch 2.9-9.el8 BaseOS 251 k python3-audit x86_64 3.0-0.17.20191104git1c2f876.el8 BaseOS 86 k python3-libsemanage x86_64 2.9-2.el8 BaseOS 127 k python3-policycoreutils noarch 2.9-9.el8 BaseOS 2.2 M python3-setools x86_64 4.2.2-2.el8 BaseOS 601 k Transaction Summary ================================================================================ Install 7 Packages Total download size: 720 M Installed size: 1.6 G Downloading Packages: (1/7): python3-audit-3.0-0.17.20191104git1c2f87 104 kB/s | 86 kB 00:00 (2/7): policycoreutils-python-utils-2.9-9.el8.n 283 kB/s | 251 kB 00:00 (3/7): python3-libsemanage-2.9-2.el8.x86_64.rpm 286 kB/s | 127 kB 00:00 (4/7): checkpolicy-2.9-1.el8.x86_64.rpm 238 kB/s | 348 kB 00:01 (5/7): python3-setools-4.2.2-2.el8.x86_64.rpm 323 kB/s | 601 kB 00:01 (6/7): python3-policycoreutils-2.9-9.el8.noarch 649 kB/s | 2.2 MB 00:03 (7/7): gitlab-ce-13.1.2-ce.0.el8.x86_64.rpm 878 kB/s | 716 MB 13:55 -------------------------------------------------------------------------------- Total 879 kB/s | 720 MB 13:57 warning: /var/cache/dnf/gitlab_gitlab-ce-7b189aab552daa48/packages/gitlab-ce-13.1.2-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY gitlab_gitlab-ce 2.1 kB/s | 3.1 kB 00:01 Importing GPG key 0x51312F3F: Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>" Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey Key imported successfully gitlab_gitlab-ce 3.0 kB/s | 3.9 kB 00:01 Importing GPG key 0xF27EAB47: Userid : "GitLab, Inc. <support@gitlab.com>" Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47 From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : python3-setools-4.2.2-2.el8.x86_64 1/7 Installing : python3-libsemanage-2.9-2.el8.x86_64 2/7 Installing : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64 3/7 Installing : checkpolicy-2.9-1.el8.x86_64 4/7 Installing : python3-policycoreutils-2.9-9.el8.noarch 5/7 Installing : policycoreutils-python-utils-2.9-9.el8.noarch 6/7 Running scriptlet: gitlab-ce-13.1.2-ce.0.el8.x86_64 7/7 Installing : gitlab-ce-13.1.2-ce.0.el8.x86_64 7/7 Running scriptlet: gitlab-ce-13.1.2-ce.0.el8.x86_64 7/7 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 Verifying : checkpolicy-2.9-1.el8.x86_64 1/7 Verifying : policycoreutils-python-utils-2.9-9.el8.noarch 2/7 Verifying : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64 3/7 Verifying : python3-libsemanage-2.9-2.el8.x86_64 4/7 Verifying : python3-policycoreutils-2.9-9.el8.noarch 5/7 Verifying : python3-setools-4.2.2-2.el8.x86_64 6/7 Verifying : gitlab-ce-13.1.2-ce.0.el8.x86_64 7/7 Installed: checkpolicy-2.9-1.el8.x86_64 gitlab-ce-13.1.2-ce.0.el8.x86_64 policycoreutils-python-utils-2.9-9.el8.noarch python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64 python3-libsemanage-2.9-2.el8.x86_64 python3-policycoreutils-2.9-9.el8.noarch python3-setools-4.2.2-2.el8.x86_64 Complete!

    GitLab CE installation has been successful.

     

    Configure GitLab CE on CentOS 8:

    Configuration files for GitLab are located in /etc/gitlab directory.

    Open gitlab.rb configuration file in a text editor.

    [root@gitlab-ce-01 ~]# vi /etc/gitlab/gitlab.rb

    Locate and set external_url directive as follows.

    external_url 'http://gitlab-ce-01.centlinux.com'

    Invoke the GitLab configuration process by using the following command. You should keep patience, because it will take a while to complete. On machine that was used in this tutorial, it took about 44 minutes to complete.

    [root@gitlab-ce-01 ~]# gitlab-ctl reconfigure Starting Chef Client, version 14.14.29 resolving cookbooks for run list: ["gitlab"] Synchronizing Cookbooks: - gitlab (0.0.1) - redis (0.1.0) - mattermost (0.1.0) - gitaly (0.1.0) - praefect (0.1.0) - letsencrypt (0.1.0) - package (0.1.0) - postgresql (0.1.0) - consul (0.1.0) - registry (0.1.0) - monitoring (0.1.0) - runit (5.1.3) - nginx (0.1.0) - crond (0.1.0) - acme (4.1.1) Installing Cookbook Gems: Compiling Cookbooks... ... ... ... Recipe: gitlab::gitlab-workhorse * runit_service[gitlab-workhorse] action restart (up to date) Recipe: monitoring::node-exporter * runit_service[node-exporter] action restart (up to date) Recipe: monitoring::gitlab-exporter * runit_service[gitlab-exporter] action restart (up to date) Recipe: monitoring::redis-exporter * runit_service[redis-exporter] action restart (up to date) Recipe: monitoring::prometheus * runit_service[prometheus] action restart (up to date) * execute[reload prometheus] action run - execute /opt/gitlab/bin/gitlab-ctl hup prometheus Recipe: monitoring::alertmanager * runit_service[alertmanager] action restart (up to date) Recipe: monitoring::postgres-exporter * runit_service[postgres-exporter] action restart (up to date) Recipe: monitoring::grafana * runit_service[grafana] action restart (up to date) Running handlers: Running handlers complete Chef Client finished, 562/1517 resources updated in 44 minutes 21 seconds gitlab Reconfigured!

     

    Access GitLab CE Web Interface:

    GitLab CE is web-based, therefore, we only requires a supported web browser to access the application.

    Browse URL http://gitlab-ce-01.centlinux.com in a browser.

    01-install-gitlab-ce-on-centos-8-change-password

    Since, we are accessing GitLab web interface for the first time therefore, we have been asked by the GitLab application to set a strong administrator password.

    Default GitLab administrative user is root.

    Set a strong password for GitLab root user.

    02-install-gitlab-ce-on-centos-8-sign-in

    Now, sign-in to GitLab application as root user.

    03-install-gitlab-ce-on-centos-8-projects

    We have reached the main screen of the GitLab application.

    Click on "Configure GitLab".

    04-install-gitlab-ce-on-centos-8-dashboard

    We have been redirected to the Dashboard of the GitLab web interface. You can confirm the versions of GitLab components that have been installed on our CentOS 8 server.

     

    Conclusion:

    We have successfully installed GitLab CE on CentOS 8 server. If you want to start your career in DevOps and more specifically with GitLab, we strongly recommend that you should buy Mastering GitLab 12: Implement DevOps culture and repository management solutions by Joost Evertse. Or enrolled in GitLab CI: Pipelines, CI/CD and DevOps for Beginners training by Udemy at a very reasonable price.

    No comments:

    Post a comment