Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Distributions»CentOS»How to Install and Configure Gitlab on CentOS 8

    How to Install and Configure Gitlab on CentOS 8

    By RahulMarch 21, 20204 Mins Read

    Gitlab is the source code management application tool. It is the best alternative to Github. It provides an option to users of the self-hosted version as well. You can simply install Gitlab server and take full advantages of its outstanding features. This tutorial will help you install and configure Gitlab (Community Edition) on your CentOS 8 Linux systems.

    Advertisement

    You can also visit our Git Tutorial section to learn about Git command line tutorials and examples.

    Step 1 – Prerequisites

    • Newly installed CentOS 8 machine.
    • Complete initial server setup
    • Domain/subdomain name for Gitlab with DNS pointed to server.

    For this tutoiral, I have launched a new droplet on DigitalOcean. Also pointed pointed “gitlab.tecadmin.net” to the droplet.

    Step 2 – Install Gitlab on CentOS 8

    First of all, enable the Gitlab repository on your CentOS system. The Gitlab team provides a shell script to configure yum repository for Linux systems. Run the below command to do it:

    curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
    

    Now, run the following command to install Gitlab community edition:

    sudo dnf install gitlab-ce
    

    The above command will install all the required applications including Nginx web server to run Gitlab on your system.

    Step 3 – Enable Let’s Encrypt SSL

    Gitlab has its enbuild feature to configure Let’s encrypt free SSL certificate on Gitlab server. You just need to enable this in the configuration file.

    Then edit the configuration file to complete configuration:

    vim /etc/gitlab/gitlab.rb
    

    Set the public accessible URL for your Gitlab server.

    external_url 'https://gitlab.tecadmin.net'
    

    You can also enable let’s encrypt ssl for your Gitlab. The installer will automatically generate Lets encrypt ssl and configure on Gitlab.

    letsencrypt['enable'] = true
    letsencrypt['contact_emails'] = ['[email protected]']
    

    Also, you can enable to auto renew of the SSL certificate

    letsencrypt['auto_renew'] = true
    letsencrypt['auto_renew_hour'] = 12
    letsencrypt['auto_renew_minute'] = 30
    letsencrypt['auto_renew_day_of_month'] = "*/7"
    

    Before enabling the Let’s encrypt, You must have point a domain/subdomain to the server’s IP. This is required to complete domain verification for issuing SSL.

    Step 4 – Configure Gitlab Server

    Next, configure Gitlab server using the following command. This will make all the installations and required changes in order to run Gitlab community edition on Ubuntu system.

    sudo gitlab-ctl reconfigure
    

    The configuration process will take time to complete setup.

    Gitlab Configuration on Linux

    Step 5 – Adjust Firewall

    The systems have enabled firealld need to allow HTTP (80) and HTTPS (443) port. This will allow you to access Gitlab server over the network. Use below commands to allow ports in firewalld.

    sudo firewall-cmd --permanent --zone=public --add-service=http
    sudo firewall-cmd --permanent --zone=public --add-service=https
    

    Next, run the following command to apply the changes:

    sudo firewall-cmd --reload
    

    Step 6 – Gitlab Dashboard Access

    Use the domain name configured with Gitlab to access web interface. For the first time, Gitlab will ask you to set the administrator password. Set the new secure password for the root user.

    https://nagios.tecadmin.net
    

    Gitlab set initial passsword

    Once you configured the password for the Gitlab root account, navigate to the login screen. Now log in with the user “root” and the specified password.

    Username:  root
    Password:  above_configured_password
    

    gitlab login

    After the successful login, you will get the dashboard access to your Gitlab server. Here you can start with the creation of users and new git repositories.

    gitlab dashboard

    Now visit our Git Tutorial to learn more about uses of Git repositories with command line helps and examples.

    Step 7 – Schedule Gitlab Data Backup

    Use the following command to create the complete backup of Gitlab data. The default backup location will be /var/opt/gitlab/backups. You can change this setting in /etc/gitlab/gitlab.rb file.

    sudo gitlab-rake gitlab:backup:create
    

    You can also add the same command scheduler to backup data nightly. Add the below cron to the system crontab.

    0 22 * * * sudo gitlab-rake gitlab:backup:create
    

    Conclusion

    You have successfully installed and configured Gitlab community edition on your Ubuntu system.

    Alternatives git Gitlab
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Mastering Git and GitHub for Version Control

    Git Change Remote URL: How to

    Git Change Remote URL in Local Repository

    Git Change Remote URL to SSH (from HTTPS)

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Configure Postfix to Use Gmail SMTP on Ubuntu & Debian
    • PHP Arrays: A Beginner’s Guide
    • Deploying Flask Application on Ubuntu (Apache+WSGI)
    • OpenSSL: Working with SSL Certificates, Private Keys and CSRs
    • How to Create and Read List in Python
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.